class ActiveRecord::Associations::Builder::HasAndBelongsToMany::JoinTableResolver::KnownClass - activerecord-4.2.5.2 Documentation

# class ActiveRecord::Associations::Builder::HasAndBelongsToMany::JoinTableResolver::KnownClass

### Public Class Methods

new(lhs_class, rhs_class_name) click to toggle source

    # File 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

### Public Instance Methods

join_table() click to toggle source

    # File 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

### Private Instance Methods

klass() click to toggle source

    # File lib/active_record/associations/builder/has_and_belongs_to_many.rb, line 19
    def klass
      @lhs_class.send(:compute_type, @rhs_class_name)
    end