lib/reactor/models/subscriber.rb in reactor-0.2.3 vs lib/reactor/models/subscriber.rb in reactor-0.2.4

- old
+ new

@@ -27,10 +27,10 @@ def subscribes_to(name = nil, data = {}) #subscribers << name #TODO: REMEMBER SUBSCRIBERS so we can define them in code as well as with a row in the DB # until then, here's a helper to make it easy to create with random data in postgres # total crap I know but whatever - define_singleton_method :first_or_create! do + define_singleton_method :exists! do chain = where(event: name) data.each do |key, value| chain = chain.where("data @> '#{key}=#{value}'") end chain.first_or_create!(data) \ No newline at end of file