class ActsAsTable::Mapper::RecordModel
ActsAsTable
mapper object for an instance of the {ActsAsTable::RecordModel} class.
@!method attribute(method_name, position_or_key = nil, **options, &block)
Returns a new ActsAsTable mapper object an instance of the {ActsAsTable::Lense} class. @param [#to_s] method_name @param [Integer, Symbol, nil] position_or_key @param [Hash<Symbol, Object>] options @option options [Boolean] :default @option options [#to_s] :primary_key @yieldparam [ActsAsTable::Mapper::Lense] lense @yieldreturn [void] @return [ActsAsTable::Mapper::Lense]
@!method belongs_to(method_name, target, &block)
Returns a new ActsAsTable mapper object an instance of the {ActsAsTable::BelongsTo} class for the `:belongs_to` macro. @param [#to_s] method_name @param [ActsAsTable::Mapper::RecordModel] target @yieldparam [ActsAsTable::Mapper::BelongsTo] belongs_to @yieldreturn [void] @return [ActsAsTable::Mapper::BelongsTo]
@!method foreign_key(method_name, position_or_key = nil, **options, &block)
Returns a new ActsAsTable mapper object an instance of the {ActsAsTable::ForeignKey} class. @param [#to_s] method_name @param [Integer, Symbol, nil] position_or_key @param [Hash<Symbol, Object>] options @option options [Boolean] :default @option options [#to_s] :primary_key @yieldparam [ActsAsTable::Mapper::ForeignKey] foreign_key @yieldreturn [void] @return [ActsAsTable::Mapper::ForeignKey]
@!method has_and_belongs_to_many(method_name, *targets, &block)
Returns a new ActsAsTable mapper object an instance of the {ActsAsTable::HasMany} class for the `:has_and_belongs_to_many` macro. @param [#to_s] method_name @param [Array<ActsAsTable::Mapper::RecordModel>] targets @yieldparam [ActsAsTable::Mapper::HasAndBelongsToMany] has_and_belongs_to_many @yieldreturn [void] @return [ActsAsTable::Mapper::HasAndBelongsToMany]
@!method has_many(method_name, *targets, &block)
Returns a new ActsAsTable mapper object an instance of the {ActsAsTable::HasMany} class for the `:has_many` macro. @param [#to_s] method_name @param [Array<ActsAsTable::Mapper::RecordModel>] targets @yieldparam [ActsAsTable::Mapper::HasMany] has_many @yieldreturn [void] @return [ActsAsTable::Mapper::HasMany]
@!method has_one(method_name, target, &block)
Returns a new ActsAsTable mapper object an instance of the {ActsAsTable::BelongsTo} class for the `:has_one` macro. @param [#to_s] method_name @param [ActsAsTable::Mapper::RecordModel] target @yieldparam [ActsAsTable::Mapper::HasOne] has_one @yieldreturn [void] @return [ActsAsTable::Mapper::HasOne]
@!method primary_key(position_or_key = nil, method_name = 'id', &block)
Returns a new ActsAsTable mapper object an instance of the {ActsAsTable::PrimaryKey} class. @param [Integer, Symbol, nil] position_or_key @param [#to_s] method_name @yieldparam [ActsAsTable::Mapper::PrimaryKey] primary_key @yieldreturn [void] @return [ActsAsTable::Mapper::PrimaryKey]
Public Class Methods
Returns a new ActsAsTable
mapper object an instance of the {ActsAsTable::RecordModel} class.
@param [ActsAsTable::RowModel] row_model @param [Hash<Symbol, ActsAsTable::ColumnModel>] column_model_by_key @param [#to_s] class_name @yieldparam [ActsAsTable::Mapper::RecordModel] record_model @yieldreturn [void] @return [ActsAsTable::Mapper::RecordModel]
ActsAsTable::Mapper::Base::new
# File lib/acts_as_table/mapper.rb, line 315 def initialize(row_model, column_model_by_key, class_name, &block) @row_model, @column_model_by_key = row_model, column_model_by_key @record_model = row_model.record_models.build(class_name: class_name) super(&block) end