Class: Granite::Form::Model::Attributes::ReferenceMany

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

Instance Attribute Summary

Attributes inherited from Base

#type_definition

Instance Method Summary collapse

Methods inherited from ReferenceOne

#read, #write

Methods inherited from Base

#came_from_default?, #came_from_user?, #initialize, #inspect_attribute, #pollute, #query, #read, #readonly?, #reset, #value_present?, #write, #write_value

Constructor Details

This class inherits a constructor from Granite::Form::Model::Attributes::Base

Instance Method Details

#read_before_type_castObject



12
13
14
15
16
# File 'lib/granite/form/model/attributes/reference_many.rb', line 12

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

#type_casted_valueObject



6
7
8
9
10
# File 'lib/granite/form/model/attributes/reference_many.rb', line 6

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