Check out the meta_where gem: https://github.com/ernie/meta_where



On 13/02/2011, at 18:16, Jan <jan.h....@gmail.com> wrote:

> Hello,
> 
> I just learned  that Arel support more powerful queries than in rails, e.g.
> 
> users = Arel::Table.new('users')
> users.where( (users[:id].eq(1)).or(users[:id].eq(2)) )
> 
> In rails it will be
> 
> User.where( (User.arel_table[:id].eq(1)).or(User.arel_table[:id].eq(2))) )
> 
> Which is too complex. DAE think it's a good to have a convinient way to 
> express above query in rails? maybe like this:
> 
> User.where(:id.eq(1).or.(:id.eq(2)))
> or
> User.where(:id => 1).or.where(:id => 2)
> ?
> 
> Or such a way already exists? If no, why not?
> 
> Regards
> Jan
> -- 
> 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+unsubscr...@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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en.

Reply via email to