Class: ActiveRecord::ConnectionAdapters::PostgreSQLAdapter
- Inherits:
-
AbstractAdapter
- Object
- AbstractAdapter
- ActiveRecord::ConnectionAdapters::PostgreSQLAdapter
- Defined in:
- lib/activerecord-postgres-hstore/activerecord.rb
Instance Method Summary collapse
- #old_quote ⇒ Object
-
#quote(value, column = nil) ⇒ Object
Quotes correctly a hstore column value.
Instance Method Details
#old_quote ⇒ Object
138 |
# File 'lib/activerecord-postgres-hstore/activerecord.rb', line 138 alias :old_quote :quote |
#quote(value, column = nil) ⇒ Object
Quotes correctly a hstore column value.
142 143 144 145 146 147 148 |
# File 'lib/activerecord-postgres-hstore/activerecord.rb', line 142 def quote(value, column = nil) if value && column && column.sql_type =~ /^hstore$/ raise HstoreTypeMismatch, "#{column.name} must have a Hash or a valid hstore value (#{value})" unless value.kind_of?(Hash) || value.valid_hstore? return value.to_hstore end old_quote(value,column) end |