Thx again, Jeremy As this might be a future improvement, I was thinking of the implications of adding sequel_postgresql_triggers, and there is an option for the timestamps. For future documentation purposes, is there a way to circumvent the trigger?
2016-05-26 16:06 GMT+02:00 Jeremy Evans <[email protected]>: > On Thursday, May 26, 2016 at 3:53:05 AM UTC-7, Tiago Cardoso wrote: >> >> Hi Jeremy >> >> I'm testing this dataset method to destroy records, and I realized that >> my dummy data in the test wasn't updating the updated_at flat >> appropriately. I have the timestamps plugin installed. Here's the >> pseudo-code: >> >> create(:record).update(updated_at: 9.days.ago) >> create(:record).update(updated_at: 7.days.ago) >> create(:record).update(updated_at: 1.day.ago) >> create(:record).update(updated_at: 1.day.from_now) >> >> They all have the same updated_at in the end. I assume that sequel is >> overwriting whatever I'm passing as a parameter. The way I see it, I set >> the value and "ask" sequel to save without timestamps (not documented, >> probably non-existing) or there's an instance method to update columns >> which bypassed model validations (something like #update_column in AR), >> which I didn't find in the documentation. What do you think it's the best >> approach? >> > > The timestamps plugin always updates the updated_at timestamp when > saving. You should just drop down to the dataset level if you don't want > to run model hooks: > > create(:record).this.update(updated_at: 1.day.from_now) > > Thanks, > Jeremy > > -- > You received this message because you are subscribed to a topic in the > Google Groups "sequel-talk" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/sequel-talk/qzji32DqXD0/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > [email protected]. > To post to this group, send email to [email protected]. > Visit this group at https://groups.google.com/group/sequel-talk. > For more options, visit https://groups.google.com/d/optout. > -- 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 post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/sequel-talk. For more options, visit https://groups.google.com/d/optout.
