Sha256: c9b43166e19050b9997bc630e2056722d36224edecf69c7bc184bee5319395cf

Contents?: true

Size: 588 Bytes

Versions: 9

Compression:

Stored size: 588 Bytes

Contents

module Desert
  module Rails
    module Observer
      def self.observers=(*observers)
        @observers = observers.flatten
      end
      def self.observers
        @observers ||= []
      end
    end
  end
end

class Rails::Initializer
  def load_observers_with_desert
    # todo verify if this should be logged
    puts  "Adding #{Desert::Rails::Observer.observers.inspect} to #{ActiveRecord::Base.observers.inspect}"
    ActiveRecord::Base.observers += Desert::Rails::Observer.observers.uniq
    load_observers_without_desert
  end
  alias_method_chain :load_observers, :desert
end

Version data entries

9 entries across 9 versions & 5 rubygems

Version Path
aaalex-desert-0.3.5.2 lib/desert/rails/observer.rb
aaalex-desert-0.3.5.3 lib/desert/rails/observer.rb
ikhono-desert-0.3.2 lib/desert/rails/observer.rb
ikhono-ikhono-desert-0.3.2 lib/desert/rails/observer.rb
joshnabbott-desert-0.3.5.2 lib/desert/rails/observer.rb
joshnabbott-desert-0.3.5.3 lib/desert/rails/observer.rb
tog-desert-0.3.4 lib/desert/rails/observer.rb
tog-desert-0.3.5.1 lib/desert/rails/observer.rb
tog-desert-0.3.5 lib/desert/rails/observer.rb