I'm trying to get the old value in the before_save
by adding "_was" to my value but it doesn't seem to work.
Here is my code:
before_save :get_old_title
def get_old_title
puts "old value #{self.title_was} => #{self.title}"
end
Both "title_was" and "title" got the new title just been saved.
Is it possible to get the old value inside before_save
?
before_save
wouldn't work. – Punysave
method inside the controller, rather callingupdate
. This is the only reason,before_save
callback didn't work. – Puny