K
Ken Ghosh
Is There A better Way to Write this
I have A Condition which previous Look Very clean and easy to understand
like
Account.first.websites.last.users.findall,:conditions => {:country =>
"XYZ",:status => "Single",:admin => nil)
Now the big problem is that user with admin = false is not picked up
i.e i want all the users from a specific country,having status as
"Single" and admin is either "nil"(Null in database) or "false"
I manage to get desired code but doesn't seem to be happy with clarity
of it
Account.first.websites.last.users.findall,:conditions => ["country = ?
AND status = ? AND admin IS NULL OR admin = ?","XYZ","Single","false"])
Any Help would be appreciated
thanks
I have A Condition which previous Look Very clean and easy to understand
like
Account.first.websites.last.users.findall,:conditions => {:country =>
"XYZ",:status => "Single",:admin => nil)
Now the big problem is that user with admin = false is not picked up
i.e i want all the users from a specific country,having status as
"Single" and admin is either "nil"(Null in database) or "false"
I manage to get desired code but doesn't seem to be happy with clarity
of it
Account.first.websites.last.users.findall,:conditions => ["country = ?
AND status = ? AND admin IS NULL OR admin = ?","XYZ","Single","false"])
Any Help would be appreciated
thanks