Module: Utusemi::Core::InstanceMethods

Includes:
Base
Defined in:
lib/utusemi/core.rb

Overview

用途

Utusemi.config.mapに設定したマッピングを意識せずに実装できるよう、
デフォルト名による各カラムへのアクセスを可能にする

使用例

Utusemi.config do
  map :product do
    name :title
  end
end

product = Product.first
product.name
#=> NoMethodError: undefined method `name' for #<Product:...>

product.utusemi(:product).name
#=> 'test product'

Instance Method Summary collapse

Methods included from Base

#utusemi, #utusemi_values

Instance Method Details

#changedObject



110
111
112
113
# File 'lib/utusemi/core.rb', line 110

def changed
  return super unless utusemi_values[:flag]
  super + super.map { |column_name| unmapped_utusemi_column_name(column_name).to_s }
end

#utusemi!(obj = nil, options = {}) ⇒ Object



106
107
108
# File 'lib/utusemi/core.rb', line 106

def utusemi!(obj = nil, options = {})
  super.tap { utusemi_columns_mapper if obj.class.in? [Symbol, String] }
end