aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2014-05-14 21:46:40 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2014-05-14 21:46:40 -0300
commita11e2fcff8cdc9691b977d8330abe63024f8c732 (patch)
tree8d690b3a233bcc7b86386d85e6b8e84d683cffca /activerecord/lib/active_record/associations
parentf85371f69d9fbc197c39b3c05b05d109952bde6e (diff)
downloadrails-a11e2fcff8cdc9691b977d8330abe63024f8c732.tar.gz
rails-a11e2fcff8cdc9691b977d8330abe63024f8c732.tar.bz2
rails-a11e2fcff8cdc9691b977d8330abe63024f8c732.zip
Don't use Active Support where it is not needed.
parent_name is a string of nil, never a blank string so we don't need to use presence.
Diffstat (limited to 'activerecord/lib/active_record/associations')
-rw-r--r--activerecord/lib/active_record/associations/builder/has_and_belongs_to_many.rb4
1 files changed, 3 insertions, 1 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 ad781e50c9..a297439214 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
@@ -24,9 +24,11 @@ module ActiveRecord::Associations::Builder
else
class_name = options.fetch(:class_name) {
model_name = name.to_s.camelize.singularize
- if parent_name = lhs_class.parent_name.presence
+
+ if parent_name = lhs_class.parent_name
model_name = model_name.prepend("#{parent_name}::")
end
+
model_name
}
KnownClass.new lhs_class, class_name