mirror of
https://github.com/github/rails.git
synced 2026-01-30 00:38:00 -05:00
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:
@@ -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
|
||||
|
||||
@@ -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" }
|
||||
|
||||
Reference in New Issue
Block a user