diff options
author | Jon Leighton <j@jonathanleighton.com> | 2011-09-29 17:59:40 +0100 |
---|---|---|
committer | Jon Leighton <j@jonathanleighton.com> | 2011-09-29 18:00:30 +0100 |
commit | adb8ac153f8e9e497eaecf62165c0bd53c18149a (patch) | |
tree | 6dc889f21b62a83f55653a7acc9fe84205850cc3 /activerecord/lib | |
parent | 4284e137ab876927b15d593358a157fe077ec238 (diff) | |
download | rails-adb8ac153f8e9e497eaecf62165c0bd53c18149a.tar.gz rails-adb8ac153f8e9e497eaecf62165c0bd53c18149a.tar.bz2 rails-adb8ac153f8e9e497eaecf62165c0bd53c18149a.zip |
Don't call self.class unless necessary. Closes #3171.
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/reflection.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/reflection.rb b/activerecord/lib/active_record/reflection.rb index 1929a808ed..120ff0cac6 100644 --- a/activerecord/lib/active_record/reflection.rb +++ b/activerecord/lib/active_record/reflection.rb @@ -212,8 +212,8 @@ module ActiveRecord end # klass option is necessary to support loading polymorphic associations - def association_primary_key(klass = self.klass) - options[:primary_key] || klass.primary_key + def association_primary_key(klass = nil) + options[:primary_key] || (klass || self.klass).primary_key end def active_record_primary_key |