Ticket #4996: through-has-one-1.23.patch
| File through-has-one-1.23.patch, 1.2 kB (added by chewi, 3 years ago) |
|---|
-
activerecord/lib/active_record/reflection.rb
old new 195 195 raise HasManyThroughAssociationPolymorphicError.new(active_record.name, self, source_reflection) 196 196 end 197 197 198 unless [:belongs_to, :has_many ].include?(source_reflection.macro) && source_reflection.options[:through].nil?198 unless [:belongs_to, :has_many, :has_one].include?(source_reflection.macro) && source_reflection.options[:through].nil? 199 199 raise HasManyThroughSourceAssociationMacroError.new(self) 200 200 end 201 201 end … … 212 212 options[:source_type] || source_reflection.class_name 213 213 else 214 214 class_name = name.to_s.camelize 215 class_name = class_name.singularize if [ :has_ many, :has_and_belongs_to_many ].include?(macro)215 class_name = class_name.singularize if [ :has_one, :has_many, :has_and_belongs_to_many ].include?(macro) 216 216 class_name 217 217 end 218 218 end