Tuesday, August 16, 2011

[Rails] Searchlogic OR condition

I'm using the gem 'searchlogic' for a search and I can not
use OR condition in eg the following:


Person.search person = (: birth_date_lte => Time.now.srftime ('% Y-% m-%
d)
: birth_date_null => null)

The SQL generated behind is:

SELECT person .* FROM person WHERE (birth_date IS NULL) AND (birth_date
<= '2011-08-16 ')

but I need to be an OR! The solution, i think, would be the following
(but not
works ..)

Person.search person = (: birth_date_null_or_lte =>
Time.now.srftime ('% Y-% m-% d))


Any ideas? Thanks!

--
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate