Set manually the created_at and updated_at attributes on object creation

Hey guys, how do I manually update created_at and updated_at attributes at the time of object creation, I already know that this does not work:

post =

title: “Hello”,

body: “Hello World!”,

created_at: mycreatedate,

updated_at: mychangedate


I suggest not doing that. If you want to save datetimes that are not the same as created and updated then add new attributes to do what you want.


And rightly so, it violates basic activerecord principles and may well break stuff.