Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR RUBY

how to update a field on after_save rails

after_save :updater
# Awesome Ruby code
# ...
# ...

private

  def updater
    self.update_column(:column_name, new_value) # This will skip validation gracefully.
  end
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #update #field #rails
ADD COMMENT
Topic
Name
9+6 =