From 7b5ed66122873eebb773a6418f3a94d946cc4f8c Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sun, 19 Dec 2004 11:25:55 +0000 Subject: Added respondence to *_before_type_cast for all attributes to return their string-state before they were type casted by the column type. Added use of *_before_type_cast for all input and text fields. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@215 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activerecord/test/validations_test.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'activerecord/test/validations_test.rb') diff --git a/activerecord/test/validations_test.rb b/activerecord/test/validations_test.rb index b6c9cfed7d..8949206706 100755 --- a/activerecord/test/validations_test.rb +++ b/activerecord/test/validations_test.rb @@ -348,4 +348,11 @@ class ValidationsTest < Test::Unit::TestCase assert_equal "hoo 5", t.errors["title"] end -end + + def test_throw_away_typing + d = Developer.create "name" => "David", "salary" => "100,000" + assert !d.valid? + assert_not_equal "100,000", d.salary + assert_equal "100,000", d.salary_before_type_cast + end +end \ No newline at end of file -- cgit v1.2.3