module Utusemi::Core::ActiveRecord::Associations

用途

関連モデルにカラムマッパを継承する

使用例

class Product
  has_many :stocks
  ...
end
stock = Product.utusemi(:product).stocks.first
stock.quantity
#=> 10 (= stocks.units)

Public Instance Methods

load_target(*args) click to toggle source
Calls superclass method
# File lib/utusemi/core.rb, line 340
def load_target(*args)
  utusemi_values = truthly_owner.utusemi_values
  return super unless utusemi_values[:flag]
  super.each { |record| record.utusemi!(@reflection.klass.model_name.singular, utusemi_values[:options]) }
end
scope(*args) click to toggle source
Calls superclass method
# File lib/utusemi/core.rb, line 334
def scope(*args)
  utusemi_values = truthly_owner.utusemi_values
  return super unless utusemi_values[:flag]
  super.utusemi!(@reflection.klass.model_name.singular, utusemi_values[:options])
end