ruby - Rails Date.today is reflecting Date of Deployment of Server -
i have rails application displays active events (events on or after today).
scope :active, where("event_date >= ?", date.today).order("event_date asc")
it coming fine on local. on production server , query taking date of deployment comparison.
this log
select "events".* "events" "events"."school_id" = 32 , (roster_id in (45) or roster_id null) , (event_date >= '2014-09-18') order event_date asc
but if check console on production, showing correctly
1.9.3-p448 :001 > date.today => fri, 19 sep 2014
server on aws ec2
any appreciated.
try putting in lambda:
scope :active, -> { where("event_date >= ?", date.today).order("event_date asc") }
probably date.today
being evaluated @ time when code loaded(i.e. deployed).
Comments
Post a Comment