aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters
diff options
context:
space:
mode:
authorJoel <joel@renewfund.com>2012-02-08 14:21:10 -0800
committerJoel <joel@renewfund.com>2012-02-08 22:28:51 -0800
commit2dd0178229ccd5e7f19f120ded85fd4a80306cac (patch)
treebbde2521a8d7ed9848acba1b814054ad719a7bd7 /activerecord/lib/active_record/connection_adapters
parent5b318a84e79d9b0a8276b382d076920befa03ca8 (diff)
downloadrails-2dd0178229ccd5e7f19f120ded85fd4a80306cac.tar.gz
rails-2dd0178229ccd5e7f19f120ded85fd4a80306cac.tar.bz2
rails-2dd0178229ccd5e7f19f120ded85fd4a80306cac.zip
Also support writing the hstore back to the database
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters')
-rw-r--r--activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb5
1 files changed, 5 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 692848d3e5..a5af8a6845 100644
--- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
@@ -476,6 +476,11 @@ module ActiveRecord
return super unless column
case value
+ when Hash
+ case column.sql_type
+ when 'hstore' then super(PostgreSQLColumn.hstore_to_string(value), column)
+ else super
+ end
when Float
return super unless value.infinite? && column.type == :datetime
"'#{value.to_s.downcase}'"