Class: ActiveRecord::ConnectionAdapters::PostgreSQLAdapter
- Inherits:
-
AbstractAdapter
- Object
- AbstractAdapter
- ActiveRecord::ConnectionAdapters::PostgreSQLAdapter
- Defined in:
- lib/activerecord-postgres-hstore/activerecord.rb
Instance Method Summary collapse
- #native_database_types ⇒ Object
- #old_native_database_types ⇒ Object
- #old_quote ⇒ Object
-
#quote(value, column = nil) ⇒ Object
Quotes correctly a hstore column value.
Instance Method Details
#native_database_types ⇒ Object
142 143 144 |
# File 'lib/activerecord-postgres-hstore/activerecord.rb', line 142 def native_database_types old_native_database_types.merge({:hstore => { :name => "hstore" }}) end |
#old_native_database_types ⇒ Object
140 |
# File 'lib/activerecord-postgres-hstore/activerecord.rb', line 140 alias :old_native_database_types :native_database_types |
#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.
147 148 149 150 151 152 153 |
# File 'lib/activerecord-postgres-hstore/activerecord.rb', line 147 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 |