diff options
author | Sammy Larbi <sam@codeodor.com> | 2014-10-08 15:58:11 -0500 |
---|---|---|
committer | Sammy Larbi <sam@codeodor.com> | 2014-11-09 11:56:07 -0600 |
commit | f43f56e16e99dae083cf1400a48c236d1af265d4 (patch) | |
tree | f9d346387343f2c4b5241d2d7296993cbb47ed43 /activerecord/lib | |
parent | 47704af54d51b240f733c596ebb39a033aa698cd (diff) | |
download | rails-f43f56e16e99dae083cf1400a48c236d1af265d4.tar.gz rails-f43f56e16e99dae083cf1400a48c236d1af265d4.tar.bz2 rails-f43f56e16e99dae083cf1400a48c236d1af265d4.zip |
Ensure HABTM relationships produce valid class names (Fixes #17119)
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/associations.rb | 2 | ||||
-rw-r--r-- | activerecord/lib/active_record/associations/builder/has_and_belongs_to_many.rb | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb index 8911506694..d2bcdc55bf 100644 --- a/activerecord/lib/active_record/associations.rb +++ b/activerecord/lib/active_record/associations.rb @@ -1700,7 +1700,7 @@ module ActiveRecord hm_options[:through] = middle_reflection.name hm_options[:source] = join_model.right_reflection.name - [:before_add, :after_add, :before_remove, :after_remove, :autosave, :validate, :join_table].each do |k| + [:before_add, :after_add, :before_remove, :after_remove, :autosave, :validate, :join_table, :class_name].each do |k| hm_options[k] = options[k] if options.key? k end 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 815e8eb97f..357b28ac94 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 @@ -98,7 +98,7 @@ module ActiveRecord::Associations::Builder def middle_options(join_model) middle_options = {} - middle_options[:class] = join_model + middle_options[:class_name] = "#{lhs_model.name}::#{join_model.name}" middle_options[:source] = join_model.left_reflection.name if options.key? :foreign_key middle_options[:foreign_key] = options[:foreign_key] |