lib/reactor/models/concerns/eventable.rb in reactor-0.2.5 vs lib/reactor/models/concerns/eventable.rb in reactor-0.2.6
- old
+ new
@@ -41,17 +41,17 @@
end
end
def reschedule_events
self.class.events.each do |name, data|
- if data[:at] && send("#{data[:watch] || data[:at]}_changed?")
+ attr_changed_method = "#{data[:watch] || data[:at]}_changed?"
+ if data[:at] && respond_to?(attr_changed_method) && send(attr_changed_method)
Reactor::Event.delay.reschedule name,
at: send(data[:at]),
actor: ( data[:actor] ? send(data[:actor]) : self ),
target: ( data[:target] ? self : nil),
was: send("#{data[:at]}_was")
end
-
if data[:if]
need_to_fire = case (ifarg = data[:if])
when Proc
instance_exec &ifarg
when Symbol
\ No newline at end of file