ruby on rails - Comparing Time.now with model dates -


my project model has 2 datetime atttributes: start_date , end_date. want projects current time in between these dates. tried start_date start with:

@projects = project.where(:start_date <= time.now) 

but returns error:

comparison of symbol time failed 

any ideas? thanks!

unlike orms, active record doesn't augment symbol class methods allow expressions other equality expressed in way. have do

project.where('start_date <= ?', time.now) 

the squeal gem adds sort of stuff , allows write

project.where{start_date < time.now} 

Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c# - Copy ObservableCollection to another ObservableCollection -

All overlapping substrings matching a java regex -