176
177
178
179
180
181
182
183
184
|
# File 'lib/insque.rb', line 176
def self.acts_as_insque_crud(*args)
options = args.
excluded = (options[: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(options).delete_if {|key| (['created_at', 'updated_at'] + excluded).include? key}
Insque.broadcast :"#{self.class.to_s.underscore.gsub '/', '_'}_#{action}", params
end
end
|