Sha256: a5d7dafd4994b364390da417031a2df0c6d7cb59c87880f29dea647d6229a0e7
Contents?: true
Size: 1.54 KB
Versions: 1
Compression:
Stored size: 1.54 KB
Contents
module Traits class Association module Through def through? reflection.through_reflection.present? end def through if through? reflection.through_reflection.klass.traits end end def through_class if through? through.active_record end end def through_association if through? from.associations[reflection.through_reflection.name] end end def source_association if through? through.associations[reflection.source_reflection.name] end end def source_association_name source_association.try(:name) end def through_association_name if through? through_association.name end end def through_table_name if through? through_association.to_table_name end end def through_to_key_name if through? through_association.to_key_name end end def through_from_key_name if through? source_association.from_key_name end end def to_hash super.merge!( through: through.try(:name), through_association: through_association_name, source_association: source_association_name, through_table_name: through_table_name, through_to_key_name: through_to_key_name, through_from_key_name: through_from_key_name ) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
activerecord-traits-1.0.0 | lib/traits/concerns/association/through.rb |