ar_pg_array 0.9.4 → 0.9.5
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -0
- data/VERSION +1 -1
- data/lib/ar_pg_array/schema.rb +2 -2
- data/spec/fixtures/schema.rb +1 -0
- data/spec/pg_array_spec.rb +3 -2
- metadata +8 -7
data/.gitignore
ADDED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.9.
|
1
|
+
0.9.5
|
data/lib/ar_pg_array/schema.rb
CHANGED
@@ -200,8 +200,8 @@ module ActiveRecord
|
|
200
200
|
|
201
201
|
def prepare_pg_text_array(value)
|
202
202
|
value = value.map{|v|
|
203
|
-
v ? v.to_s.gsub('\\','\\\\\\').gsub('"','\"') : 'NULL'
|
204
|
-
}.inspect
|
203
|
+
v ? v.to_s.gsub('\\','\\\\\\').gsub('"','\"') : '@!$%NULL%$!@'
|
204
|
+
}.inspect.gsub('"@!$%NULL%$!@"','NULL')
|
205
205
|
value.tr!('[]','{}')
|
206
206
|
end
|
207
207
|
|
data/spec/fixtures/schema.rb
CHANGED
@@ -17,5 +17,6 @@ ActiveRecord::Schema.define do
|
|
17
17
|
t.timestamp_array :times, :default => %w{2010-01-01 2010-02-01}
|
18
18
|
t.float_array :floats, :default => [1.0, 1.2]
|
19
19
|
t.decimal_array :decimals, :default => [1.0, 1.2]
|
20
|
+
t.text_array :texts, :default => [nil, 'Text', 'NULL', 'Text with nil', 'Text with , nil, !', 'nil']
|
20
21
|
end
|
21
22
|
end
|
data/spec/pg_array_spec.rb
CHANGED
@@ -12,7 +12,7 @@ describe "PgArray" do
|
|
12
12
|
before :each do
|
13
13
|
@ability = @ability_class.new
|
14
14
|
end
|
15
|
-
|
15
|
+
|
16
16
|
it "should change type" do
|
17
17
|
[].pg.should be_an_instance_of(PGArrays::PgArray)
|
18
18
|
[].search_any.should be_an_instance_of(PGArrays::PgAny)
|
@@ -78,6 +78,7 @@ describe "PgArray" do
|
|
78
78
|
bulk.strings.should == %w{as so}
|
79
79
|
bulk.floats.should == [1.0, 1.2]
|
80
80
|
bulk.decimals.should == [1.0, 1.2]
|
81
|
+
bulk.texts.should == [nil, 'Text', 'NULL', 'Text with nil', 'Text with , nil, !', 'nil']
|
81
82
|
map_times(bulk.times).should ==
|
82
83
|
map_times(parse_times(%w{2010-01-01 2010-02-01}))
|
83
84
|
end
|
@@ -95,7 +96,7 @@ describe "PgArray" do
|
|
95
96
|
bulk.decimals.should == [2.5, 2]
|
96
97
|
map_times(bulk.times).should == map_times(parse_times(%w{2010-04-01 2010-03-01}))
|
97
98
|
end
|
98
|
-
|
99
|
+
|
99
100
|
it "should allow to use sql" do
|
100
101
|
bulks_where(['ints && ?', [1,2].pg]).should == bulks_where(:id=>[1,2,3])
|
101
102
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ar_pg_array
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 49
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 9
|
9
|
-
-
|
10
|
-
version: 0.9.
|
9
|
+
- 5
|
10
|
+
version: 0.9.5
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Sokolov Yura aka funny_falcon
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2011-01-20 00:00:00 +03:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -41,6 +41,7 @@ extensions: []
|
|
41
41
|
extra_rdoc_files:
|
42
42
|
- README
|
43
43
|
files:
|
44
|
+
- .gitignore
|
44
45
|
- MIT-LICENSE
|
45
46
|
- README
|
46
47
|
- Rakefile
|
@@ -98,8 +99,8 @@ specification_version: 3
|
|
98
99
|
summary: Use power of PostgreSQL Arrays in ActiveRecord
|
99
100
|
test_files:
|
100
101
|
- spec/fixtures/schema.rb
|
101
|
-
- spec/fixtures/item.rb
|
102
|
-
- spec/fixtures/bulk.rb
|
103
102
|
- spec/fixtures/tag.rb
|
104
|
-
- spec/
|
103
|
+
- spec/fixtures/bulk.rb
|
104
|
+
- spec/fixtures/item.rb
|
105
105
|
- spec/spec_helper.rb
|
106
|
+
- spec/pg_array_spec.rb
|