The problem is that this code is executed only once when your application loads, and therefore the actual date does not change. You have to change it to load lazily:
default_scope lambda { { :conditions => ["departure_date >= ?", DateTime.current.beginning_of_day] } }
Therefore, it Datetime.current.beginning_of_daywill be evaluated every time you make a request.
source
share