Permalink
Browse files

SQLServer: don't choke on strings containing 'null'. Closes #7083.

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6084 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
jeremy committed Jan 28, 2007
1 parent e720ba0 commit 16f6bd4070d57fc1eacb1a531385af205233a573
View
@@ -1,5 +1,7 @@
*SVN*
+* SQLServer: don't choke on strings containing 'null'. #7083 [Jakob S]
+
* MySQL: blob and text columns may not have defaults in 5.x. Update fixtures schema for strict mode. #6695 [Dan Kubb]
* update_all can take a Hash argument. sanitize_sql splits into two methods for conditions and assignment since NULL values and delimiters are handled differently. #6583, #7365 [sandofsky, Assaf]
@@ -73,7 +73,7 @@ def simplified_type(field_type)
end
def type_cast(value)
- return nil if value.nil? || value =~ /^\s*null\s*$/i
+ return nil if value.nil?
case type
when :datetime then cast_to_datetime(value)
when :timestamp then cast_to_time(value)
@@ -164,8 +164,16 @@ def test_save_null_string_attributes
topic.reload
assert_equal("null", topic.title)
assert_equal("null", topic.author_name)
- end
-
+ end
+
+ def test_save_nil_string_attributes
+ topic = Topic.find(1)
+ topic.title = nil
+ topic.save!
+ topic.reload
+ assert_nil topic.title
+ end
+
def test_hashes_not_mangled
new_topic = { :title => "New Topic" }
new_topic_values = { :title => "AnotherTopic" }

0 comments on commit 16f6bd4

Please sign in to comment.