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
151 152 153 154 155 156 157 158 159 160 |
# File 'lib/insque.rb', line 151 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_any_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 |