Class: ActsAsTable::Mapper::PrimaryKey
- Defined in:
- lib/acts_as_table/mapper.rb
Overview
ActsAsTable mapper object for an instance of the PrimaryKey class.
Instance Method Summary collapse
-
#initialize(row_model, column_model_by_key, record_model, position_or_key, method_name = 'id') {|primary_key| ... } ⇒ ActsAsTable::Mapper::PrimaryKey
constructor
Returns a new ActsAsTable mapper object an instance of the PrimaryKey class.
Constructor Details
#initialize(row_model, column_model_by_key, record_model, position_or_key, method_name = 'id') {|primary_key| ... } ⇒ ActsAsTable::Mapper::PrimaryKey
Returns a new ActsAsTable mapper object an instance of the PrimaryKey class.
231 232 233 234 235 236 237 238 239 |
# File 'lib/acts_as_table/mapper.rb', line 231 def initialize(row_model, column_model_by_key, record_model, position_or_key, method_name = 'id', &block) @row_model, @column_model_by_key, @record_model = row_model, column_model_by_key, record_model @record_model.primary_keys.build(method_name: method_name) do |primary_key| primary_key.column_model = position_or_key.is_a?(::Symbol) ? @column_model_by_key[position_or_key] : @row_model.column_models[position_or_key - 1] end super(&block) end |