aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2013-10-02 19:01:16 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2013-10-02 19:01:16 -0700
commit7768c2a7f3142b422c90dfea451f74643994be52 (patch)
tree9fdcdc3ab378ac6a12a8c6d65024dc86f7372d0e /activerecord
parentcb0aa02e74d2ee3c79adebaf1657e7544c08018e (diff)
downloadrails-7768c2a7f3142b422c90dfea451f74643994be52.tar.gz
rails-7768c2a7f3142b422c90dfea451f74643994be52.tar.bz2
rails-7768c2a7f3142b422c90dfea451f74643994be52.zip
fix the variable name
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/associations/builder/has_and_belongs_to_many.rb14
1 files changed, 7 insertions, 7 deletions
diff --git a/activerecord/lib/active_record/associations/builder/has_and_belongs_to_many.rb b/activerecord/lib/active_record/associations/builder/has_and_belongs_to_many.rb
index b4537c5564..af596a3a64 100644
--- a/activerecord/lib/active_record/associations/builder/has_and_belongs_to_many.rb
+++ b/activerecord/lib/active_record/associations/builder/has_and_belongs_to_many.rb
@@ -4,28 +4,28 @@ module ActiveRecord::Associations::Builder
KnownTable = Struct.new :join_table
class KnownClass
- def initialize(rhs_class, lhs_class_name)
- @rhs_class = rhs_class
- @lhs_class_name = lhs_class_name
+ def initialize(lhs_class, rhs_class_name)
+ @lhs_class = lhs_class
+ @rhs_class_name = rhs_class_name
@join_table = nil
end
def join_table
- @join_table ||= [@rhs_class.table_name, klass.table_name].sort.join("\0").gsub(/^(.*_)(.+)\0\1(.+)/, '\1\2_\3').gsub("\0", "_")
+ @join_table ||= [@lhs_class.table_name, klass.table_name].sort.join("\0").gsub(/^(.*_)(.+)\0\1(.+)/, '\1\2_\3').gsub("\0", "_")
end
private
- def klass; @lhs_class_name.constantize; end
+ def klass; @rhs_class_name.constantize; end
end
- def self.build(rhs_class, name, options)
+ def self.build(lhs_class, name, options)
if options[:join_table]
KnownTable.new options[:join_table]
else
class_name = options.fetch(:class_name) {
name.to_s.camelize.singularize
}
- KnownClass.new rhs_class, class_name
+ KnownClass.new lhs_class, class_name
end
end
end