aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/attribute_methods_test.rb
diff options
context:
space:
mode:
authorSergey Nartimov <just.lest@gmail.com>2012-02-16 19:49:38 +0300
committerSergey Nartimov <just.lest@gmail.com>2012-02-16 19:49:38 +0300
commitec4759d205efaf4c7f5c2f28bd6f6b07989990d6 (patch)
treed485b386a50f34747b374f3f596ccc8b98f57639 /activerecord/test/cases/attribute_methods_test.rb
parenta5874dd118fb205f78e0becee44c4eac01127f8c (diff)
downloadrails-ec4759d205efaf4c7f5c2f28bd6f6b07989990d6.tar.gz
rails-ec4759d205efaf4c7f5c2f28bd6f6b07989990d6.tar.bz2
rails-ec4759d205efaf4c7f5c2f28bd6f6b07989990d6.zip
move id_before_type_cast to PrimaryKey module
Diffstat (limited to 'activerecord/test/cases/attribute_methods_test.rb')
-rw-r--r--activerecord/test/cases/attribute_methods_test.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/activerecord/test/cases/attribute_methods_test.rb b/activerecord/test/cases/attribute_methods_test.rb
index 3ac2a76b96..4078b7eb0b 100644
--- a/activerecord/test/cases/attribute_methods_test.rb
+++ b/activerecord/test/cases/attribute_methods_test.rb
@@ -121,6 +121,14 @@ class AttributeMethodsTest < ActiveRecord::TestCase
assert keyboard.respond_to?('id')
end
+ def test_id_before_type_cast_with_custom_primary_key
+ keyboard = Keyboard.create
+ keyboard.key_number = '10'
+ assert_equal '10', keyboard.id_before_type_cast
+ assert_equal nil, keyboard.read_attribute_before_type_cast('id')
+ assert_equal '10', keyboard.read_attribute_before_type_cast('key_number')
+ end
+
# Syck calls respond_to? before actually calling initialize
def test_respond_to_with_allocated_object
topic = Topic.allocate