Sandip Ransing wrote:
> Is it possible to have OR conditions using named scope ??
> For e.g. Gather users based on following or conditions.
> 1. active is one named scope which finds all users whose state is active
> 2. OR user id is in 1,2,3
>
> This condition can be written in only one named scope as
>
> named_scope :active_or_explicit, lambda{ |ids|
> { :conditions => ['state = ? OR id in (?)', 'active', [1,2,3]] }
> }
>
> Is it possible to have two named scopes that can be joined using OR
> condition.
>
Goodness, I hope not. That would be a terrible misuse of named_scopes.
> Please let me know your views...
Please see
http://groups.google.com/group/rubyonrails-talk/msg/7789576953707b2e for
some of my reasoning.
>
> --
> Sandip
>
> ---
> www.funonrails.com
Best,
--
Marnen Laibow-Koser
http://www.marnen.org
[email protected]
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" 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-talk?hl=en.