Class: Hash
- Inherits:
-
Object
- Object
- Hash
- Defined in:
- lib/activerecord-postgres-hstore/hash.rb
Instance Method Summary collapse
-
#from_hstore ⇒ Object
If the method from_hstore is called in a Hash, it just returns self.
-
#to_hstore ⇒ Object
Generates a single quoted hstore string format.
Instance Method Details
#from_hstore ⇒ Object
If the method from_hstore is called in a Hash, it just returns self.
12 13 14 |
# File 'lib/activerecord-postgres-hstore/hash.rb', line 12 def from_hstore self end |
#to_hstore ⇒ Object
Generates a single quoted hstore string format. This is the format used to insert or update stuff in the database.
5 6 7 8 9 |
# File 'lib/activerecord-postgres-hstore/hash.rb', line 5 def to_hstore return "''" if empty? #@todo DIOGO! Check security issues with this quoting pleaz map{|idx,val| "('#{idx}'=>'#{val.to_s.gsub(/'/,"''")}')" }.join(' || ') end |