开发者

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:

  1. end_date field isn't empty
  2. parameter input_date is in the period between (start_date + 1 day) and end_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 :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜