aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Koziarski <michael@koziarski.com>2007-01-16 01:39:05 +0000
committerMichael Koziarski <michael@koziarski.com>2007-01-16 01:39:05 +0000
commit71a4f7161fb02cd5b2cefb374224be94b185306a (patch)
tree583117c93627db2bdb554cd44184930c44d8d644
parent8437be33801d598b3b3389163cb3082fb04b0ec8 (diff)
downloadrails-71a4f7161fb02cd5b2cefb374224be94b185306a.tar.gz
rails-71a4f7161fb02cd5b2cefb374224be94b185306a.tar.bz2
rails-71a4f7161fb02cd5b2cefb374224be94b185306a.zip
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
-rw-r--r--activerecord/lib/active_record/connection_adapters/oracle_adapter.rb1
-rwxr-xr-xactiverecord/test/base_test.rb11
2 files changed, 10 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/oracle_adapter.rb b/activerecord/lib/active_record/connection_adapters/oracle_adapter.rb
index b44510fd7d..01eb350da4 100644
--- a/activerecord/lib/active_record/connection_adapters/oracle_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/oracle_adapter.rb
@@ -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
diff --git a/activerecord/test/base_test.rb b/activerecord/test/base_test.rb
index 672ad6f0bc..e1dd5704db 100755
--- a/activerecord/test/base_test.rb
+++ b/activerecord/test/base_test.rb
@@ -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" }