Class: ActiveRecord::Associations::Builder::HasAndBelongsToMany::JoinTableResolver::KnownClass
- Inherits:
-
Object
- Object
- ActiveRecord::Associations::Builder::HasAndBelongsToMany::JoinTableResolver::KnownClass
- Defined in:
- activerecord/lib/active_record/associations/builder/has_and_belongs_to_many.rb
Instance Method Summary collapse
-
#initialize(lhs_class, rhs_class_name) ⇒ KnownClass
constructor
A new instance of KnownClass.
- #join_table ⇒ Object
Constructor Details
#initialize(lhs_class, rhs_class_name) ⇒ KnownClass
Returns a new instance of KnownClass.
7 8 9 10 11 |
# File 'activerecord/lib/active_record/associations/builder/has_and_belongs_to_many.rb', line 7 def initialize(lhs_class, rhs_class_name) @lhs_class = lhs_class @rhs_class_name = rhs_class_name @join_table = nil end |
Instance Method Details
#join_table ⇒ Object
13 14 15 |
# File 'activerecord/lib/active_record/associations/builder/has_and_belongs_to_many.rb', line 13 def join_table @join_table ||= [@lhs_class.table_name, klass.table_name].sort.join("\0").gsub(/^(.*[._])(.+)\0\1(.+)/, '\1\2_\3').gsub("\0", "_") end |