Ruby on Rails Sunday, September 24, 2017

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 = Post.new(
  title: "Hello",
  body: "Hello World!",
  created_at: mycreatedate, 
  updated_at: mychangedate
)

post.save

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/ee93e41b-8bfd-40bc-9bb5-60811e7be844%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment