Help writing a Ruby on Rails search
I have a Note object, which has a开发者_JAVA百科 start_date
field (date, required) and an end_date
field (date, optional).
How can I write a search (in Ruby 1.9.2 & Rails 3) that will find notes that meet these 2 conditions:
end_date
field isn't empty- parameter
input_date
is in the period between (start_date
+ 1 day) andend_date
Thanks for reading.
What's the problem. I mean, do you get an error or you simply forgot to read the ActiveRecord documentation? ;)
You can use the #where
method to create the query.
You might also like this: https://github.com/binarylogic/searchlogic :)
精彩评论