Just want to get this onto the table, "what most people expect" is not the
only measure of a good API choice.

To specifically answer Aaron's question, for #4598, I think the fix for that
would be for subsequent `default_scope`s to just overwrite previous ones
entirely.  Not to merge with them.

For the broader question which seems to be what this thread is about, ie.
what to do with: User.where(:foo => 1).where(:foo => 2) how about adding
alias `and` as an alias for `where`, and adding `or` as an alias for "where
that does ORs".  So the syntax could be:

User.where(:foo => 1).and(:foo => 2)


And:

User.where(:foo => 1).or(:foo => 2)


I'm sure I don't need to state what SQL each of those turn into (the real
test for a good API :)

On Wed, Feb 16, 2011 at 9:10 AM, Robert Pankowecki <
[email protected]> wrote:

> On Wed, Feb 16, 2011 at 5:59 PM, Aaron Patterson
> <[email protected]> wrote:
> > The intentional change fixes this bug:
> >
> >
> https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/4598-default_scope-treats-hashes-and-relations-inconsistently-when-overwriting
> >
> > If there is a different way to fix that ticket, I'm happy to apply
> > patches.
>
> The different way is to make both cases return an empty array. David
> (who created the ticket) expects something different but I am not sure
> that this is what most people expect.
>
> Could we provide a different method for such behavior as expected by David
> ?
>
> Robert Pankowecki
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Core" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-core?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en.

Reply via email to