module Itemable::ActsAsItemable::BelongsToItem::ClassMethods

Public Instance Methods

belongs_to_item(association_name, options={}) click to toggle source
# File lib/itemable/acts_as_itemable.rb, line 92
def belongs_to_item(association_name, options={})
  default_options = {
    through: :item_parent,
    source: :parent,
    source_type: association_name.to_s.classify
  }
  has_one association_name, default_options.merge(options.symbolize_keys)
end