blob: bf680b6624441beed7d3dda635a6c60c46bed6bb (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
module ActiveRecord
module ConnectionAdapters
module PostgreSQL
module OID # :nodoc:
class Hstore < Type::Value
def type
:hstore
end
def type_cast_for_write(value)
# roundtrip to ensure uniform uniform types
# TODO: This is not an efficient solution.
cast_value(type_cast_for_database(value))
end
def type_cast_for_database(value)
ConnectionAdapters::PostgreSQLColumn.hstore_to_string(value)
end
def cast_value(value)
ConnectionAdapters::PostgreSQLColumn.string_to_hstore value
end
def accessor
ActiveRecord::Store::StringKeyedHashAccessor
end
end
end
end
end
end
|