Rails3 ActiveRecord query where?

In Rails 3 , it’s possible to write a query like

account_type = AccountType.where(:membership_fees => 0; :locale =>
{:code => I18n.locale}).first
to find records when membership_fees == 0
( AccountType belongs to Locale)

is it possible to write the same query for membership_fees >
0

or should I write as in Rails 2 a pure condition ?

Client.where(“membership_fees > ? AND memberships.locale = ?”, 0 ],
I18n.locale)

thanks for your feedback

On Saturday, May 28, 2011 8:14:47 AM UTC-6, Erwin wrote:

or should I write as in Rails 2 a pure condition ?

Client.where(“membership_fees > ? AND memberships.locale = ?”, 0 ],
I18n.locale)

thanks for your feedback

I know this was posted some time ago (haven’t read this list is a while)
but
just in case you’re still interested…

I’d recommend you check out the meta_where gem:

https://github.com/ernie/meta_where

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs