Finding record between 2 dates

You can do this very easily with a named scope in your model:

named_scope :between, lambda {|start_date, end_date| {:conditions =>
["created_at BETWEEN :start AND :end", {:start => start_date, :end =>
end_date}]}}