Rails verifica se has_many mudou
class Company < ActiveRecord::Base has_many :employees accepts_nested_attributes_for :employees def employees_changed? employees.select { |e| e.new_record? || e.marked_for_destruction? }.any? endend
Continuar lendoConteúdo para você se capacitar em programação
class Company < ActiveRecord::Base has_many :employees accepts_nested_attributes_for :employees def employees_changed? employees.select { |e| e.new_record? || e.marked_for_destruction? }.any? endend
Continuar lendo