Skip to content
Browse files

Merge [6084] from trunk. References #7083.

git-svn-id: http://svn-commit.rubyonrails.org/rails/branches/1-2-stable@6085 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent b79c0a0 commit 57098ad859dc7b7b23323063d5698f73d81f70f9 @jeremy jeremy committed Jan 28, 2007
View
2 activerecord/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* SQLServer: don't choke on strings containing 'null'. #7083 [Jakob S]
+
* Consistently use LOWER() for uniqueness validations (rather than mixing with UPPER()) so the database can always use a functional index on the lowercased column. #6495 [Si]
* MySQL: SET SQL_AUTO_IS_NULL=0 so 'where id is null' doesn't select the last inserted id. #6778 [Jonathan Viney, timc]
View
2 activerecord/lib/active_record/connection_adapters/sqlserver_adapter.rb
@@ -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)
View
12 activerecord/test/base_test.rb
@@ -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 57098ad

Please sign in to comment.
Something went wrong with that request. Please try again.