Sha256: 7da86926280fc01ceddf49b30d01a97c7878a209f2d791c206d93076ac747e73
Contents?: true
Size: 795 Bytes
Versions: 17
Compression:
Stored size: 795 Bytes
Contents
module PgSerializable module Nodes class Association < Base attr_reader :klass, :name, :trait, :type, :label def initialize(klass, name, type, label: nil, trait: :default) @name = name @klass = klass @type = type @label = label || name @trait = trait end def to_sql(outer_alias, aliaser) ["\'#{@label}\'", "(#{value(outer_alias, aliaser)})"].join(',') end def target @target ||= association.klass end def association @association ||= @klass.reflect_on_association(@name) end def foreign_key @foreign_key ||= association.join_foreign_key end def primary_key @primary_key ||= association.join_primary_key end end end end
Version data entries
17 entries across 17 versions & 1 rubygems