activerecord-postgres-array 0.0.9 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: a860a4d54f9d5febfcc864a4d7fe965de6c13b4d
|
4
|
+
data.tar.gz: 503165e36ada67ee90c575e9642ba587c4c5e8cb
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 01e3a6a9a25ff02726fd7cf276cb41adf56b947deed4e30b17c9f66e7e2fb195588331c6c2ecd1033ccf109636c1656a712e697f148486b735b3e09aefc87b68
|
7
|
+
data.tar.gz: 8093e677b770e336faab41ea194b2d3d251fff4bcd9f22dc55a51ecd8724291b8bf0367ae8085284656c9ed0d34107c9379372ce5630009a3ef47711d31d088b
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "activerecord-postgres-array"
|
3
|
-
s.version = "0.0.
|
3
|
+
s.version = "0.0.10"
|
4
4
|
|
5
5
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
6
6
|
s.authors = ["Tim Connor"]
|
@@ -15,7 +15,8 @@ Gem::Specification.new do |s|
|
|
15
15
|
|
16
16
|
s.add_dependency "activerecord"
|
17
17
|
s.add_development_dependency 'rake'
|
18
|
-
s.add_development_dependency 'rspec', '~> 2.0'
|
18
|
+
s.add_development_dependency 'rspec', '~> 2.12.0'
|
19
19
|
s.add_development_dependency 'pg'
|
20
|
+
s.add_development_dependency 'activerecord-postgres-hstore'
|
20
21
|
s.add_development_dependency 'combustion', '~> 0.3.1'
|
21
22
|
end
|
@@ -15,7 +15,7 @@ module ActiveRecord
|
|
15
15
|
if include_readonly_attributes || !self.class.readonly_attributes.include?(name)
|
16
16
|
value = read_attribute(name)
|
17
17
|
if column.type.to_s =~ /_array$/ && value && value.is_a?(Array)
|
18
|
-
value = value.to_postgres_array(new_record?)
|
18
|
+
value = "'#{value.to_postgres_array(new_record?)}'"
|
19
19
|
elsif klass.serialized_attributes.include?(name)
|
20
20
|
value = @attributes[name].serialized_value
|
21
21
|
end
|
data/spec/integration_spec.rb
CHANGED
@@ -38,6 +38,37 @@ describe Article do
|
|
38
38
|
article.languages_before_type_cast.should == '{"\\\\","\\""}'
|
39
39
|
article.languages.should == ["\\","\""]
|
40
40
|
end
|
41
|
+
|
42
|
+
it 'does not interfere with YAML serialization' do
|
43
|
+
article = Article.create!(
|
44
|
+
:languages => ['a','b'],
|
45
|
+
:author_ids => [1, 2, 3],
|
46
|
+
:prices => [1.1, 2.2, 3.3],
|
47
|
+
:serialized_column => {:a => 1, :b => 2}
|
48
|
+
)
|
49
|
+
article.reload
|
50
|
+
|
51
|
+
article.serialized_column.should == {:a => 1, :b => 2}
|
52
|
+
article.languages.should == ['a', 'b']
|
53
|
+
article.author_ids.should == [1, 2, 3]
|
54
|
+
article.prices.should == [1.1, 2.2, 3.3]
|
55
|
+
end
|
56
|
+
|
57
|
+
it 'does not interfere with hstore serialization' do
|
58
|
+
article = Article.create!(
|
59
|
+
:languages => ['a','b'],
|
60
|
+
:author_ids => [1, 2, 3],
|
61
|
+
:prices => [1.1, 2.2, 3.3],
|
62
|
+
:hstore_column => {:a => 1, :b => 2}
|
63
|
+
)
|
64
|
+
article.reload
|
65
|
+
|
66
|
+
article.hstore_column['a'].to_s.should == '1'
|
67
|
+
article.hstore_column['b'].to_s.should == '2'
|
68
|
+
article.languages.should == ['a', 'b']
|
69
|
+
article.author_ids.should == [1, 2, 3]
|
70
|
+
article.prices.should == [1.1, 2.2, 3.3]
|
71
|
+
end
|
41
72
|
end
|
42
73
|
|
43
74
|
describe ".update" do
|
@@ -87,6 +118,18 @@ describe Article do
|
|
87
118
|
@article.languages_before_type_cast.should == '{"\\\\","\\""}'
|
88
119
|
@article.languages.should == ["\\","\""]
|
89
120
|
end
|
90
|
-
end
|
91
121
|
|
122
|
+
it 'is able to be contatenated with new arrays' do
|
123
|
+
article = Article.new
|
124
|
+
article.languages = (article.languages || []) + ['a', 'b', 'c']
|
125
|
+
article.save!
|
126
|
+
article.reload
|
127
|
+
article.languages.should == ['a', 'b', 'c']
|
128
|
+
|
129
|
+
article.languages += ['d']
|
130
|
+
article.save!
|
131
|
+
article.reload
|
132
|
+
article.languages.should == ['a', 'b', 'c', 'd']
|
133
|
+
end
|
134
|
+
end
|
92
135
|
end
|
data/spec/internal/db/schema.rb
CHANGED
@@ -1,8 +1,17 @@
|
|
1
1
|
ActiveRecord::Schema.define do
|
2
|
+
execute "CREATE EXTENSION hstore"
|
3
|
+
|
2
4
|
create_table(:articles, :force => true) do |t|
|
3
5
|
t.string :name
|
4
6
|
t.string_array :languages
|
5
7
|
t.integer_array :author_ids
|
6
8
|
t.float_array :prices
|
9
|
+
|
10
|
+
# To make sure we don't interfere with YAML serialization
|
11
|
+
t.string :serialized_column
|
12
|
+
|
13
|
+
# To make sure we don't interfere with activerecord-postgres-hstore
|
14
|
+
t.hstore :hstore_column
|
7
15
|
end
|
16
|
+
add_hstore_index :articles, :hstore_column
|
8
17
|
end
|
metadata
CHANGED
@@ -1,104 +1,105 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord-postgres-array
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 0
|
9
|
-
- 9
|
10
|
-
version: 0.0.9
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.10
|
11
5
|
platform: ruby
|
12
|
-
authors:
|
6
|
+
authors:
|
13
7
|
- Tim Connor
|
14
8
|
autorequire:
|
15
9
|
bindir: bin
|
16
10
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
- !ruby/object:Gem::Dependency
|
11
|
+
date: 2012-02-08 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
21
14
|
name: activerecord
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
hash: 3
|
29
|
-
segments:
|
30
|
-
- 0
|
31
|
-
version: "0"
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
32
20
|
type: :runtime
|
33
|
-
version_requirements: *id001
|
34
|
-
- !ruby/object:Gem::Dependency
|
35
|
-
name: rake
|
36
21
|
prerelease: false
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
46
34
|
type: :development
|
47
|
-
version_requirements: *id002
|
48
|
-
- !ruby/object:Gem::Dependency
|
49
|
-
name: rspec
|
50
35
|
prerelease: false
|
51
|
-
|
52
|
-
|
53
|
-
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
54
45
|
- - ~>
|
55
|
-
- !ruby/object:Gem::Version
|
56
|
-
|
57
|
-
segments:
|
58
|
-
- 2
|
59
|
-
- 0
|
60
|
-
version: "2.0"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 2.12.0
|
61
48
|
type: :development
|
62
|
-
|
63
|
-
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 2.12.0
|
55
|
+
- !ruby/object:Gem::Dependency
|
64
56
|
name: pg
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
65
63
|
prerelease: false
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: activerecord-postgres-hstore
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
75
76
|
type: :development
|
76
|
-
version_requirements: *id004
|
77
|
-
- !ruby/object:Gem::Dependency
|
78
|
-
name: combustion
|
79
77
|
prerelease: false
|
80
|
-
|
81
|
-
|
82
|
-
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: combustion
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
83
87
|
- - ~>
|
84
|
-
- !ruby/object:Gem::Version
|
85
|
-
hash: 17
|
86
|
-
segments:
|
87
|
-
- 0
|
88
|
-
- 3
|
89
|
-
- 1
|
88
|
+
- !ruby/object:Gem::Version
|
90
89
|
version: 0.3.1
|
91
90
|
type: :development
|
92
|
-
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ~>
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 0.3.1
|
93
97
|
description: Adds support for postgres arrays to ActiveRecord
|
94
98
|
email: tlconnor@gmail.com
|
95
99
|
executables: []
|
96
|
-
|
97
100
|
extensions: []
|
98
|
-
|
99
101
|
extra_rdoc_files: []
|
100
|
-
|
101
|
-
files:
|
102
|
+
files:
|
102
103
|
- Gemfile
|
103
104
|
- LICENSE
|
104
105
|
- Rakefile
|
@@ -116,36 +117,25 @@ files:
|
|
116
117
|
- spec/string_ext_spec.rb
|
117
118
|
homepage: https://github.com/tlconnor/activerecord-postgres-array
|
118
119
|
licenses: []
|
119
|
-
|
120
|
+
metadata: {}
|
120
121
|
post_install_message:
|
121
122
|
rdoc_options: []
|
122
|
-
|
123
|
-
require_paths:
|
123
|
+
require_paths:
|
124
124
|
- lib
|
125
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
none: false
|
136
|
-
requirements:
|
137
|
-
- - ">="
|
138
|
-
- !ruby/object:Gem::Version
|
139
|
-
hash: 3
|
140
|
-
segments:
|
141
|
-
- 0
|
142
|
-
version: "0"
|
125
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
126
|
+
requirements:
|
127
|
+
- - '>='
|
128
|
+
- !ruby/object:Gem::Version
|
129
|
+
version: '0'
|
130
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
131
|
+
requirements:
|
132
|
+
- - '>='
|
133
|
+
- !ruby/object:Gem::Version
|
134
|
+
version: '0'
|
143
135
|
requirements: []
|
144
|
-
|
145
136
|
rubyforge_project:
|
146
|
-
rubygems_version:
|
137
|
+
rubygems_version: 2.0.2
|
147
138
|
signing_key:
|
148
|
-
specification_version:
|
139
|
+
specification_version: 4
|
149
140
|
summary: Adds support for postgres arrays to ActiveRecord
|
150
141
|
test_files: []
|
151
|
-
|