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
?
Instead of before_save
use before_update
. It should work now.