On Wed, Feb 16, 2011 at 12:21 PM, Ernie Miller <[email protected]> wrote:
> which is
> more likely the desired result if two scopes are merged and both
> include equality conditions on the same column.

I doubt that. There are a lot of cases (especially when using
search/filter functionality of application) where you want it to
generate an empty set because there are no matching records. Everybody
everywhere in current code assumes that the condition will be added
with 'AND' operator and now we are breaking this assumption ?

If I want to have 'OR' then I would build the query this way:

State.where(:abbreviation => ['TX', 'NE'])
or using longer but perfectly fine and valid arel version...



An example:

def where_something(scope, value)
 scope.where(:column => value)
end

This code is ambiguous now. I do not know what sql it is going to
generate. Will it be
"AND column =  value"
or
"(... OR column = value)" ?



Please revert it to the original behavior and provide a different way
of achieving this like:

State.possible(:abbreviation => 'TX').possible(:abbreviation => 'NE') =>
sql:  "states.abbrevation = 'TX' OR states.abbrevation = 'NE"

or whatever different method name that reveals the intentions clearly

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.

Reply via email to