Hi folks.
I wrote the pull request that''s in for this.
I''m still looking for some feedback.
In particular the main issue with it is in replacing the where clauses
without hosing other aspects of the scopes.
Perhaps Aaron would like to take a look at it, as I know he has done a fair
bit of spelunking in arel etc.
https://github.com/rails/rails/pull/6817
Sent from my iPad
On 10 Aug 2012, at 17:44, "Dr. Steve Leung" <steve@leungs.me>
wrote:
I''d be quite interested in a feature merging scopes with OR - currently
the
default way is AND.
The feature seems to have been requested/reported here:
https://github.com/rails/rails/issues/5545
A pull request was sent, but it needs some work.
I wrote a quick attempt too here: https://gist.github.com/3312792
It uses the syntax:
Jobship.includes(:job).or(Jobship.accepted, Jobship.declined).count
though it might be better like this:
Jobship.where(accepted.or(declined)).count
Thoughts?
It doesn''t look like it should be too hard - any reason why this
isn''t
included in the current ActiveRecord?
I haven''t dug too deep into ActiveRecord::Relation or Arel... but I
think
this is a common use case.
Anyone interested in helping me work on this further?
Steve
--
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 rubyonrails-core@googlegroups.com.
To unsubscribe from this group, send email to
rubyonrails-core+unsubscribe@googlegroups.com.
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 rubyonrails-core@googlegroups.com.
To unsubscribe from this group, send email to
rubyonrails-core+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/rubyonrails-core?hl=en.