On Tue, Jan 5, 2021 at 3:07 AM [email protected] <[email protected]> wrote:

> Having trouble with selecting the age of records from their creation date
> field *cdate*.
>
> puts DL[:yachts].
>   select(Sequel.function(:age, :cdate, Time.now),
>     cast(:interval)).
>     extract(:hour).to_a
>
> Tried this without the cast to :interval and it trips over the coercion to
> array:
>
> puts DL[:yachts].
>   select(Sequel.function(:age, :cdate, Time.now),
>     extract(:hour).to_a
>
> Not sure how to grab ages from a *creation_date* field.
>

As your example isn't self contained, I can only guess that this is what
you need:

puts DL[:yachts].
  select(Sequel.function(:age, :cdate, Time.now).extract(:hour)).
  to_a

Thanks,
Jeremy

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sequel-talk/CADGZSSfPuUFrYP_aUS1xow9rkbDqgMbvwYFq_UzmjG80HtoW3A%40mail.gmail.com.

Reply via email to