aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations.rb
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2014-05-08 09:51:48 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2014-05-08 09:51:48 -0700
commit6ffce1791ab989afb0f3bc1dd579804fc9a5c756 (patch)
treef70fe3247765badcb144ebc6a693a5870ae80055 /activerecord/lib/active_record/associations.rb
parent83e0544204a1b0125af15e1ea0e54aa30b2266ab (diff)
downloadrails-6ffce1791ab989afb0f3bc1dd579804fc9a5c756.tar.gz
rails-6ffce1791ab989afb0f3bc1dd579804fc9a5c756.tar.bz2
rails-6ffce1791ab989afb0f3bc1dd579804fc9a5c756.zip
set a constant for the "anonymous" habtm model fixes #15022
I wanted the middle model to be anonymous, but we have to give it a name for marshal support. :'(
Diffstat (limited to 'activerecord/lib/active_record/associations.rb')
-rw-r--r--activerecord/lib/active_record/associations.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb
index ac1479ad8f..d66a79a137 100644
--- a/activerecord/lib/active_record/associations.rb
+++ b/activerecord/lib/active_record/associations.rb
@@ -1576,6 +1576,11 @@ module ActiveRecord
join_model = builder.through_model
+ # FIXME: we should move this to the internal constants. Also people
+ # should never directly access this constant so I'm not happy about
+ # setting it.
+ const_set join_model.name, join_model
+
middle_reflection = builder.middle_reflection join_model
Builder::HasMany.define_callbacks self, middle_reflection