ruby - Rails, Postgres, ActiveRecord query postgres based on columns value -
i working rails
, postgresql
, i'm trying query postgres db based on value of column.
to put perspective, have events
table in postgres , in table have events recurring , aren't based on column value of repeats
.
if events recur, have value of daily
, weekly
, monthly
, etc. inside of repeats
column. obviously, if doesn't recur value set null
.
i receive events recur in repeats
column. if it's null, query skip on it.
i've looked through activerecord query interface
due inexperience, unable find helper trick me.
please let me know if more info needed.
any advice appreciated. thanks!
event.where.not(repeats: nil)
alternatively, can specify sql stream
event.where("repeats not null")
Comments
Post a Comment