Sha256: ac366eef954fb69a2431709d1590a332f93a1ed87a0d7d015086a8e25ac8d4cd

Contents?: true

Size: 359 Bytes

Versions: 76

Compression:

Stored size: 359 Bytes

Contents

class ReferenceObserver < ActiveRecord::Observer

  observe :'ActiveRecord::Base'

  def before_save(record)
    if record.respond_to?(:reference_id) and Usuario.current.present? and Usuario.current.reference_id.present?
      record.reference_id = Usuario.current.reference_id
    end
  end

  def before_validation(record)
    before_save(record)
  end

end

Version data entries

76 entries across 76 versions & 1 rubygems

Version Path
templus_models-3.0.21 test/dummy/app/models/reference_observer.rb
templus_models-3.0.20 test/dummy/app/models/reference_observer.rb
templus_models-3.0.19 test/dummy/app/models/reference_observer.rb
templus_models-3.0.17 test/dummy/app/models/reference_observer.rb
templus_models-2.0.16 test/dummy/app/models/reference_observer.rb
templus_models-1.6.9 test/dummy/app/models/reference_observer.rb
templus_models-2.0.15 test/dummy/app/models/reference_observer.rb
templus_models-3.0.14 test/dummy/app/models/reference_observer.rb
templus_models-2.0.14 test/dummy/app/models/reference_observer.rb
templus_models-2.0.12 test/dummy/app/models/reference_observer.rb
templus_models-3.0.13 test/dummy/app/models/reference_observer.rb
templus_models-3.0.12 test/dummy/app/models/reference_observer.rb
templus_models-2.0.11 test/dummy/app/models/reference_observer.rb
templus_models-2.0.9 test/dummy/app/models/reference_observer.rb
templus_models-2.0.8 test/dummy/app/models/reference_observer.rb
templus_models-3.0.10 test/dummy/app/models/reference_observer.rb
templus_models-1.6.8 test/dummy/app/models/reference_observer.rb
templus_models-1.6.7 test/dummy/app/models/reference_observer.rb
templus_models-3.0.9 test/dummy/app/models/reference_observer.rb
templus_models-2.0.7 test/dummy/app/models/reference_observer.rb