diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2005-10-24 16:45:22 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2005-10-24 16:45:22 +0000 |
commit | 0e4c5b0288c3fab5ec8bdc4d7448be2b72e55e58 (patch) | |
tree | b72c70a63bc414bee9ba378a79daa62cb4e36100 /activerecord/lib | |
parent | 8ac9638646434a811357071be44ba84051d0f1dc (diff) | |
download | rails-0e4c5b0288c3fab5ec8bdc4d7448be2b72e55e58.tar.gz rails-0e4c5b0288c3fab5ec8bdc4d7448be2b72e55e58.tar.bz2 rails-0e4c5b0288c3fab5ec8bdc4d7448be2b72e55e58.zip |
r2726@asus: jeremy | 2005-10-24 14:11:59 -0700
correct primary key semantics: foo.id and foo.real_pk_column should both exist and return nil if foo.new_record?
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2718 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib')
-rwxr-xr-x | activerecord/lib/active_record/base.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 2f954eddc1..e6ccfd4659 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -1451,7 +1451,7 @@ module ActiveRecord #:nodoc: cast_code = column.type_cast_code('v') access_code = cast_code ? "(v=@attributes['#{attr_name}']) && #{cast_code}" : "@attributes['#{attr_name}']" - unless symbol == :id + unless attr_name.to_s == self.class.primary_key.to_s access_code = access_code.insert(0, "raise NoMethodError, 'missing attribute: #{attr_name}', caller unless @attributes.has_key?('#{attr_name}'); ") end |