Module: ActiverecordToPoro::MetadataEnabledAr

Extended by:
ActiveSupport::Concern
Defined in:
lib/activerecord_to_poro/metadata_enabled_ar.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#_referenced_porosObject



12
13
14
# File 'lib/activerecord_to_poro/metadata_enabled_ar.rb', line 12

def _referenced_poros
  @_referenced_poros ||= []
end

#_update_poro_metadataObject



16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/activerecord_to_poro/metadata_enabled_ar.rb', line 16

def 
  _referenced_poros.each do |entity|
    entity. = self if entity.respond_to? :_set_metadata_from_ar=

    [:id, :updated_at, :created_at, :lock_version,].each do |magic_col|
       entity.send("#{magic_col}=", send(magic_col)) if [entity, self].all? { |obj| obj.respond_to? magic_col }
    end
  end

  @_referenced_poros = nil # one way method to prevent circular references

  true
end