This problem occurred for models which have child models.
Therefore I added before_create method in the model.
def before_create self.created_at = Time.now if self.created_at.blank? self.updated_at = Time.now if self.updated_at.blank? endThis method will fix the problem.
Did you know the problem why you had null created_at?
ReplyDeleteHave someone understood what's the problem?
ReplyDeleteThis could happen when you play with ActiveRecord::Base.record_timestamps = false.
ReplyDeleteHey Pioz,
ReplyDeleteYou saved my day. Thanks