Hi,
Can anyone spot why the below doesn’t work?
- I have a “created_by” column in my create table in the dB
- I have a “before_create” line, which definitely gets called
- I tried a few different ways to set the “created_by” attribute in the
model but it doesn’t seem to work, i.e. doesn’t appear in the database
=============================
class Contact < ActiveRecord::Base
before_create :generic_fields
private
def generic_fields
created_by=“test text” <=== DOESN’T SET IT
self.created_by=“test text” <=== DOESN’T SET IT
@created_by=“test text” <=== DOESN’T SET IT
end
end
=============================
=> self.created_by= <== Not set (in database it’s not set either)
Tks