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 |
# File 'lib/insque.rb', line 117 def self.acts_as_insque_crud(*args) = args. excluded = ([:exclude] || []).map(&:to_s) set_callback :commit, :after do action = [:create, :update, :destroy].map {|a| a if transaction_include_action?(a) }.compact.first 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 |