callback_name = "fire_#{state}_state_after_save"
self.class.skip_callback(:save, :after, "(#{callback_name})")
save
self.class.set_callback(:save, :after, callback_name, :if => "state_event_if_#{state}_changed")
Conteúdo para você se capacitar em programação
callback_name = "fire_#{state}_state_after_save"
self.class.skip_callback(:save, :after, "(#{callback_name})")
save
self.class.set_callback(:save, :after, callback_name, :if => "state_event_if_#{state}_changed")