When I try u = User.new
followed by u.save
, the before_save
method is not being fired.
Here's my User
model:
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/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With