On Friday, August 28, 2015 at 7:35:42 PM UTC-7, Jon Mattingly wrote: > > I have the following code - > User.where(:id => params[:id]).update(:total_levels_played => > Sequel.expr(1) + :total_levels_played) > > I'm using the timestamps plugin to set updated_at automatically. However, > when I run the above code, the object is updated but the timestamp is not. > It seems the only way to change updated_at is by running object.save. Is > that intended behavior? >
Yes, the behavior is expected. Dataset-level updates are not going to call model code, and timestamps is a model plugin. If you really care about it, use a database trigger to enforce things (e.g. https://github.com/jeremyevans/sequel_postgresql_triggers). 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 post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sequel-talk. For more options, visit https://groups.google.com/d/optout.
