aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2014-03-13 11:49:00 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2014-03-13 11:49:00 -0700
commit23ffd03ede9b27a6cbc3154aa99c247b718ccdbc (patch)
tree019381cef90f2dae6e4926ff4dbf4574a8d84e33 /activerecord
parent7658dc37a40077444fee1eafcf4a59fae1b441a5 (diff)
downloadrails-23ffd03ede9b27a6cbc3154aa99c247b718ccdbc.tar.gz
rails-23ffd03ede9b27a6cbc3154aa99c247b718ccdbc.tar.bz2
rails-23ffd03ede9b27a6cbc3154aa99c247b718ccdbc.zip
add the deprecation to adequate record too
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/core.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/core.rb b/activerecord/lib/active_record/core.rb
index 7d81934526..73ca468d80 100644
--- a/activerecord/lib/active_record/core.rb
+++ b/activerecord/lib/active_record/core.rb
@@ -128,7 +128,11 @@ module ActiveRecord
ids.first.kind_of?(Array)
id = ids.first
- id = id.id if ActiveRecord::Base === id
+ if ActiveRecord::Base === id
+ id = id.id
+ ActiveSupport::Deprecation.warn "You are passing an instance of ActiveRecord::Base to `find`." \
+ "Please pass the id of the object by calling `.id`"
+ end
key = primary_key
s = find_by_statement_cache[key] || find_by_statement_cache.synchronize {