activerecord-postgres-hstore 0.0.4 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.4
1
+ 0.1.0
@@ -137,6 +137,11 @@ module ActiveRecord
137
137
 
138
138
  alias :old_quote :quote
139
139
  alias :old_columns :columns
140
+ alias :old_native_database_types :native_database_types
141
+
142
+ def native_database_types
143
+ old_native_database_types.merge({:hstore => { :name => "hstore" }})
144
+ end
140
145
 
141
146
  # Quotes correctly a hstore column value.
142
147
  def quote(value, column = nil)
@@ -148,4 +153,4 @@ module ActiveRecord
148
153
  end
149
154
  end
150
155
  end
151
- end
156
+ end
@@ -1,6 +1,11 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
2
 
3
3
  describe "ActiverecordPostgresHstore" do
4
+
5
+ it "should convert hstore string to hash" do
6
+ ["('a'=>'1') || ('b'=>'2')", "('b'=>'2') || ('a'=>'1')"].should include({:a => 1, :b => 2}.to_hstore)
7
+ end
8
+
4
9
  it "should convert hash to hstore string" do
5
10
  {:a => 1, :b => 2}.to_hstore.should == "('a'=>'1') || ('b'=>'2')"
6
11
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-postgres-hstore
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 27
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
+ - 1
8
9
  - 0
9
- - 4
10
- version: 0.0.4
10
+ version: 0.1.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Juan Maiz
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-09-12 00:00:00 -04:00
18
+ date: 2011-03-10 00:00:00 -03:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency