diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2012-02-03 17:17:41 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2012-02-07 14:13:47 -0800 |
commit | 41f21fafa76e8dc1284650cd24aea2edd770e6b2 (patch) | |
tree | fc292502d255492f947c2c39e42e42e09ded1ad5 /activerecord/lib/active_record/connection_adapters | |
parent | 5396fca1e2ab656e460713523efe3a5b1e967d30 (diff) | |
download | rails-41f21fafa76e8dc1284650cd24aea2edd770e6b2.tar.gz rails-41f21fafa76e8dc1284650cd24aea2edd770e6b2.tar.bz2 rails-41f21fafa76e8dc1284650cd24aea2edd770e6b2.zip |
pgcolumn knows how to typecast binary columns
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb index 5b150f2731..d61ca17391 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb @@ -39,6 +39,12 @@ module ActiveRecord super(name, self.class.extract_value_from_default(default), sql_type, null) end + def type_cast(value) + return super unless sql_type == 'bytea' + + PGconn.unescape_bytea(value) if value + end + # :stopdoc: class << self attr_accessor :money_precision |