Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR RUBY

rails activerecord saved_change_to

saved_change_to_attribute?(attr_name, **options)

# rerurns true if attr_name value changed in the last save

=begin
Did this attribute change when we last saved?
This method is useful in after callbacks to determine if
an attribute was changed during the save that triggered the
callbacks to run. It can be invoked as saved_change_to_name?
instead of saved_change_to_attribute?("name").
=end
Source by api.rubyonrails.org #
 
PREVIOUS NEXT
Tagged: #rails #activerecord
ADD COMMENT
Topic
Name
5+5 =