Would the core team be open to the removal of the '&' alias for
ActiveRecord::Relation#merge?

The reason is that in Ruby the '&' operator refers to an intersection
of two sets of data, not a merge. (within the context of the Array
class)

Recently Arel added support for SQL Set Operators:

2-0-stable: 
https://github.com/rails/arel/commit/9e816c406399139d9ca76d2089df7f2d94d4fb8b
master: 
https://github.com/rails/arel/commit/74caeaad157e79853b9c6804f561d3c70eea2346
and 
https://github.com/rails/arel/commit/d532b7ee430c5d0c412ab9f1a5e0dd3ebc47f86b

So this allows for a higher level abstraction to use the Array class'
convention:

'|' => Union
'+' => UnionALL
'&' => Intersect
'-' => Except (Minus for Oracle)

to operate on two ActiveRecord::Relation instances.

This is sitting as a pending pull request on MetaWhere:
https://github.com/ernie/meta_where/pull/12

Ernie Miller and I have been going back and forth. Ernie points out
that ActiveRecord is using the alias '&' a few times in the code base
instead of 'merge' and overriding this method in MetaWhere would cause
some major issues.

Thoughts?

-- 
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