Sha256: 72c13d6e3ed47fbdb162bbd199721311e1bc810dbd753e8430d3d388fc271bf7
Contents?: true
Size: 719 Bytes
Versions: 17
Compression:
Stored size: 719 Bytes
Contents
module Superstore module BelongsTo class Reflection attr_reader :model, :name, :options def initialize(model, name, options) @model, @name, @options = model, name, options end def instance_variable_name "@#{name}" end def foreign_key options[:foreign_key] || "#{name}_id" end def primary_key options[:primary_key] || "id" end def default_primary_key? primary_key == "id" end def polymorphic_column "#{name}_type" end def polymorphic? options[:polymorphic] end def class_name options[:class_name] || name.to_s.camelize end end end end
Version data entries
17 entries across 17 versions & 1 rubygems