Class: ActiveRecord::Base
- Inherits:
-
Object
- Object
- ActiveRecord::Base
- Defined in:
- lib/insque.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.acts_as_insque_crud(*args) ⇒ Object
117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/insque.rb', line 117 def self.acts_as_insque_crud(*args) = args. excluded = ([:exclude] || []).map(&:to_s) [:update, :create, :destroy].each do |action| set_callback :commit, :after, on: action do params = self.serializable_hash().delete_if {|key| (['created_at', 'updated_at'] + excluded).include? key} Insque.broadcast :"#{self.class.to_s.underscore}_#{action}", params end end end |
Instance Method Details
#send_later(method, *args) ⇒ Object
114 115 116 |
# File 'lib/insque.rb', line 114 def send_later(method, *args) Insque.broadcast :send_later, {:class => self.class.name, :id => id, :method => method, :args => args }, :self end |