method

before_create

Importance_2
v1.2.6 - Show latest stable - 2 notes - Class: ActiveRecord::Callbacks
before_create() public

Is called before Base.save on new objects that haven’t been saved yet (no record exists).

Show source
Register or log in to add new notes.
April 14, 2015
0 thanks

Deprecation

It still exists but you give it a block instead of creating a method:

<=2.3.8

def before_create
  self.login = self.first_name
end

Now

before_create :set_login

def set_login
  self.login = self.first_name
end
February 11, 2015
0 thanks

Why is this deprecated?

Anyone knows?