ActiveRecord will handle converting a Time into something your database
understands, so you don't need to worry about that. You can also write the
where clause manually like you did, or you can use arel, which would be my
preference. You can also chain .where()'s, since they just return
On Sunday, January 29, 2017 at 1:29:03 PM UTC-5, Joe Guerra wrote:
>
> I'm trying to figure out how to compare my enddate > Time.now in my where
> clause.
>
> enddate is a date field, I'm just trying to only display products that
> haven't expired (by the date field).
>
>
> I've tried...
>
>
I'm trying to figure out how to compare my enddate > Time.now in my where
clause.
enddate is a date field, I'm just trying to only display products that
haven't expired (by the date field).
I've tried...
require 'time'
products.where(['enddate > ?', Time.now])
--
You received this
On Sat, Jan 28, 2017 at 11:44 PM, Tushar Garg
wrote:
> Those errors were related testing. Becoz lot of things in Rspec are
> depriciated, when I remove Rspec and testing part from it, then its working
> fine.
But "removing testing" to make it "work" is an extremely
4 matches
Mail list logo