Allow the Oracle adapter to insert a string "null". Closes #6997 [laurelfan]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5958 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
Michael Koziarski
2007-01-16 01:39:05 +00:00
parent 8437be3380
commit 71a4f7161f
2 changed files with 10 additions and 2 deletions

View File

@@ -66,7 +66,6 @@ begin
class OracleColumn < Column #:nodoc:
def type_cast(value)
return nil if value =~ /^\s*null\s*$/i
return guess_date_or_time(value) if type == :datetime && OracleAdapter.emulate_dates
super
end

View File

@@ -69,7 +69,7 @@ class BasicsTest < Test::Unit::TestCase
assert_equal("Jason", topic.author_name)
assert_equal(topics(:first).author_email_address, Topic.find(1).author_email_address)
end
def test_integers_as_nil
test = AutoId.create('value' => '')
assert_nil AutoId.find(test.id).value
@@ -156,6 +156,15 @@ class BasicsTest < Test::Unit::TestCase
reply = Reply.new
assert_raise(ActiveRecord::RecordInvalid) { reply.save! }
end
def test_save_null_string_attributes
topic = Topic.find(1)
topic.attributes = { "title" => "null", "author_name" => "null" }
topic.save!
topic.reload
assert_equal("null", topic.title)
assert_equal("null", topic.author_name)
end
def test_hashes_not_mangled
new_topic = { :title => "New Topic" }