Ruby on Rails Sunday, September 24, 2017



On 25 Sep 2017 6:21 a.m., "Cassio Almeida" <jcassiocosta@gmail.com> wrote:
Hey guys, how do I manually update created_at and updated_at attributes at the time of object creation

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. 

Colin



, 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.

--
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/CAL%3D0gLvKH7Bo_rvdXoXABk4ACQvsucOizKetS3cKB3Voi1fCmA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment