Skip to content
Browse files

fix for the bytea/binary nil value bug

  • Loading branch information...
1 parent 0ddfd75 commit 280c5ed1f990c4b29ea214eeaf81d95a8407ce93 @mattetti mattetti committed
View
1 activerecord/lib/active_record/connection_adapters/postgresql/oid.rb
@@ -20,6 +20,7 @@ def type_cast(value)
class Bytea < Type
def type_cast(value)
+ return if value.nil?
PGconn.unescape_bytea value
end
end
View
2 activerecord/test/cases/adapters/postgresql/bytea_test.rb
@@ -69,7 +69,7 @@ def test_write_value
assert_equal(data, record.payload)
end
- def test_write_file
+ def test_write_binary
data = File.read(File.join(File.dirname(__FILE__), '..', '..', '..', 'assets', 'example.log'))
assert(data.size > 1)
record = ByteaDataType.create(payload: data)

0 comments on commit 280c5ed

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