Yet, this code works fine:
customer = Customer.new(:name => ‘Ray’)
customer.date_created = Time.now.to_s(:db)
customer.save!
Is there something I’m doing wrong that is preventing me from putting
everything in the new method?
Have you excluded date_created from mass updates via attr_accessible
or attr_protected? If so, the second method is the only way that
currently works, however I’d like to see new_unsafe, create_unsafe,
build_unsafe, attributes_unsafe=, and update_attributes_unsafe methods
that bypass protection for use in internal processing.
The other alternative is some problem with your Customer.initialize
code.
–
We develop, watch us RoR, in numbers too big to ignore.