method

before_create

rails latest stable - Class: ActiveRecord::Callbacks

Method deprecated or moved

This method is deprecated or moved on the latest stable version. The last existing version (v2.3.8) is shown here.

before_create()
public

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

2Notes

Why is this deprecated?

ryanrhie9 · Feb 11, 2015

Anyone knows?

Deprecation

exadeci · Apr 14, 2015

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