problem with comparing date in Ruby (findbySql)
WHERE
l.created_at > #{params[:daysAgo].to_i.days.ago.strftime('%Y-%m-%d')}
is working correctly but
WHERE
l.created_at > '#{params[:daysAgo].to_i.days.ago.strftime('%Y-%m-%d 00:00')}'
is not returning any rows... can anyone help.. but for date compa开发者_如何学Gorison we should use quotes right..??
You can convert time to database one by to_s(:db)
For example,
Time.now.to_s(:db)
I found that database time is better use Time.zone
in Rails
Time.zone.now.to_s(:db)
精彩评论