ben
ben

Reputation: 29817

Help writing a Ruby on Rails search

I have a Note object, which has a 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.

Upvotes: 0

Views: 119

Answers (2)

dmnkhhn
dmnkhhn

Reputation: 1023

You might also like this: https://github.com/binarylogic/searchlogic :)

Upvotes: 0

Simone Carletti
Simone Carletti

Reputation: 176562

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.

Upvotes: 2

Related Questions