All,
I have the following AR object:
class UploadedFile < ActiveRecord::Base
protected
def after_initialize
self.path = ‘abc’
end
end
When I call UploadedFile.new and pass it a value for the “name”
attribute, I don’t see the path attribute get a value like I expect.
See (from script/console):
uf = UploadedFile.new(:name => “xyz”)
=> #<UploadedFile id: nil, name: “xyz”, path: nil, created_at: nil,
updated_at: nil>
AFAIK, after_initialize is ok to use in Rails 2.1.
What am I doing wrong here?
Wes