I know this has got to be a really dumb question, but here goes anyway.
I’ve got a model with an associated table. One of the columns in the
table is ‘date_created’, which I want to be set to the date/time each
row was added to the table.
Seems to me that setting this in the initialize method for the model
would be the right thing to do,…
class MyThing < ActiveRecord::Base
@date_created = DateTime.now
But that throws other errors since the controller is calling the class
with additional arguments from the form entry that started the process.
@thing = MyThing.new(params[:thing])
I know I must be missing something pretty basic, but any help getting me
pointed in the right direction would be greatly appreciated.