I have an ActiveRecord model that has a date attribute. Is it possible to utilize that date attribute to find by Year, Day and Month:
Model.find_by_year(201
I think the easiest way to do this is a scope:
scope :date, lambda {|date| where('date_field > ? AND date_field < ?', DateTime.parse(date).beginning_of_day, DateTime.parse(date).end_of_day}
Use it like this:
Model.date('2012-12-1').all
That will return all models with a date_field between the beginning and end of day for the date you send.