123456789_123456789_123456789_123456789_123456789_

Class: ActiveRecord::Associations::Builder::HasAndBelongsToMany::JoinTableResolver::KnownClass

Class Method Summary

Instance Method Summary

Constructor Details

.new(lhs_class, rhs_class_name) ⇒ KnownClass

[ GitHub ]

  
# 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

[ GitHub ]

  
# 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').tr("\0", "_")
end