ruby - date function error in rails 3 -
i trying add date conditional controller index action:
@events = event.where("date" => date.today.to_s).order("date").page(params[:page]).per_page(5)
i trying make view show events have date value greater or equal today's date. example if event has date value of 2013-05-13 should not shown because event has happened , events date value of today's date or later should shown.
the problem is, index view isn't returning events , have created date value of 2013-05-30 means should work. ideas?
thanks in advance
this going return date equals today:
event.where("date" => date.today.to_s)
what want instead is:
event.where("date >= ?", date.today)
activerecord interpolate date ?
. also, don't need call to_s
on it, activerecord date you.
Comments
Post a Comment