Sha256: 838e5e24276f40d407b3634eaff089214bec286a075e05c2249f25808f49ae88

Contents?: true

Size: 526 Bytes

Versions: 5

Compression:

Stored size: 526 Bytes

Contents

class ORM
  include ActiveModel::Observing

  def save
    notify_observers :before_save
  end

  class Observer < ActiveModel::Observer
    def before_save_invocations
      @before_save_invocations ||= []
    end

    def before_save(record)
      before_save_invocations << record
    end
  end
end

class Widget < ORM; end
class Budget < ORM; end
class WidgetObserver < ORM::Observer; end
class BudgetObserver < ORM::Observer; end
class AuditTrail < ORM::Observer
  observe :widget, :budget
end

ORM.instantiate_observers

Version data entries

5 entries across 5 versions & 3 rubygems

Version Path
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/rails-observers-0.1.2/test/models/observers.rb
rails-observers-0.1.2 test/models/observers.rb
rails-observers-0.1.1 test/models/observers.rb
rails-observers-0.1.0 test/models/observers.rb
mass_assignment_with_multiple_roles-0.0.1 test/models/observers.rb