Class: ActsAsTable::Mapper::BelongsTo
- Defined in:
- lib/acts_as_table/mapper.rb
Overview
ActsAsTable mapper object for an instance of the BelongsTo class for the :belongs_to
macro.
Instance Method Summary collapse
-
#initialize(row_model, column_model_by_key, record_model, method_name, target) {|belongs_to| ... } ⇒ ActsAsTable::Mapper::BelongsTo
constructor
Returns a new ActsAsTable mapper object an instance of the BelongsTo class for the
:belongs_to
macro.
Constructor Details
#initialize(row_model, column_model_by_key, record_model, method_name, target) {|belongs_to| ... } ⇒ ActsAsTable::Mapper::BelongsTo
Returns a new ActsAsTable mapper object an instance of the BelongsTo class for the :belongs_to
macro.
33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/acts_as_table/mapper.rb', line 33 def initialize(row_model, column_model_by_key, record_model, method_name, target, &block) @row_model, @column_model_by_key, @record_model = row_model, column_model_by_key, record_model @row_model.belongs_tos.build(macro: 'belongs_to', method_name: method_name) do |belongs_to| belongs_to.source_record_model = @record_model belongs_to.target_record_model = target.send(:instance_variable_get, :@record_model) end super(&block) end |