ruby on rails - Can I use PostgreSQL's "Special Date/Time Inputs" with ActiveRecord? -
postgresql supports several "special date/time inputs", strings interprets upon execution. eg, 'now' means "current transaction's start time", , 'infinity' means "later other timestamps".
activerecord not seem understand these - eg, somerecord.update!(updated_at: datetime.current) works, somerecord.update!(updated_at: 'now') tries execute update query null.
these special strings work in rails fixtures, because go straight database. there way use them instantiated model?
you can set value raw_write_attribute(:updated_at, 'now')
Comments
Post a Comment