Sha256: aab05131c8713ccfd1c2ee415207994035752ca4f0b4b03599b7770b7da7fe50

Contents?: true

Size: 1015 Bytes

Versions: 22

Compression:

Stored size: 1015 Bytes

Contents

class Eye < ActiveRecord::Base
  attr_reader :after_create_callbacks_stack
  attr_reader :after_update_callbacks_stack
  attr_reader :after_save_callbacks_stack

  # Callbacks configured before the ones has_one sets up.
  after_create :trace_after_create
  after_update :trace_after_update
  after_save   :trace_after_save

  has_one :iris
  accepts_nested_attributes_for :iris

  # Callbacks configured after the ones has_one sets up.
  after_create :trace_after_create2
  after_update :trace_after_update2
  after_save   :trace_after_save2
  
  def trace_after_create
    (@after_create_callbacks_stack ||= []) << !iris.persisted?
  end
  alias trace_after_create2 trace_after_create

  def trace_after_update
    (@after_update_callbacks_stack ||= []) << iris.changed?
  end
  alias trace_after_update2 trace_after_update

  def trace_after_save
    (@after_save_callbacks_stack ||= []) << iris.changed?
  end
  alias trace_after_save2 trace_after_save
end

class Iris < ActiveRecord::Base
  belongs_to :eye
end

Version data entries

22 entries across 22 versions & 3 rubygems

Version Path
ibm_db-5.2.0 test/models/eye.rb
ibm_db-5.1.0 test/models/eye.rb
ibm_db-5.0.5 test/models/eye.rb
ibm_db-5.0.4 test/models/eye.rb
ibm_db-5.0.3 test/models/eye.rb
ibm_db-5.0.2 test/models/eye.rb
ibm_db-4.0.0-x86-mingw32 test/models/eye.rb
ibm_db-4.0.0 test/models/eye.rb
ibm_db-3.0.4-x86-mingw32 test/models/eye.rb
ibm_db-3.0.4 test/models/eye.rb
ibm_db-3.0.3-x86-mingw32 test/models/eye.rb
ibm_db-3.0.3 test/models/eye.rb
ibm_db-3.0.2-x86-mingw32 test/models/eye.rb
ibm_db-3.0.2 test/models/eye.rb
activejob-lock-0.0.2 rails/activerecord/test/models/eye.rb
ibm_db-3.0.1 test/models/eye.rb
ibm_db-3.0.1-x86-mingw32 test/models/eye.rb
activejob-lock-0.0.1 rails/activerecord/test/models/eye.rb
activerecord-nuodb-adapter-2.0.3 test/models/eye.rb
activerecord-nuodb-adapter-2.0 test/models/eye.rb