Class: ActiveData::Model::Attributes::ReferenceMany

Inherits:
ReferenceOne show all
Defined in:
lib/active_data/model/attributes/reference_many.rb

Instance Attribute Summary

Attributes inherited from Base

#name, #owner

Instance Method Summary collapse

Methods inherited from ReferenceOne

#read, #type, #typecaster, #write

Methods inherited from Base

#initialize, #inspect_attribute, #pollute, #query, #read, #readonly?, #reflection, #reset, #typecast, #value_present?, #write, #write_value

Constructor Details

This class inherits a constructor from ActiveData::Model::Attributes::Base

Instance Method Details

#read_before_type_castObject



11
12
13
14
15
# File 'lib/active_data/model/attributes/reference_many.rb', line 11

def read_before_type_cast
  variable_cache(:value_before_type_cast) do
    Array.wrap(@value_cache)
  end
end

#type_casted_valueObject



5
6
7
8
9
# File 'lib/active_data/model/attributes/reference_many.rb', line 5

def type_casted_value
  variable_cache(:value) do
    read_before_type_cast.map { |id| typecast(id) }
  end
end