When I try u = User.new and then u.save , the before_save method before_save not start.
u = User.new
u.save
before_save
Here is my User model:
User
class User < ActiveRecord::Base attr_accessor :password before_save :encrypt_password def encrypt_password puts "Its getting called" end end
https://railsforum.com/topic/1741-rails-4-and-before-save-method/
Callback methods must be either protected or private .
protected
private
From here: http://api.rubyonrails.org/classes/ActiveRecord/Callbacks.html in the Types of callbacks section
Types of callbacks