module BinnacleAr::Hooks::ClassMethods
Public Instance Methods
binnacle_signal(options = {})
click to toggle source
# File lib/binnacle_ar/hooks.rb, line 6 def binnacle_signal(options = {}) options[:on] ||= [:create, :update, :destroy] options_on = Array(options[:on]) after_create :record_create if options_on.include?(:create) after_update :record_update if options_on.include?(:update) after_destroy :record_destroy if options_on.include?(:destroy) after_initialize do @binnacle_client = Binnacle::Client.new(ENV['BINNACLE_API_KEY'], ENV['BINNACLE_API_SECRET']) end include BinnacleAr::Hooks::InstanceMethods end