jsonb_accessor 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: df479f24a7add99510b13cb3ef66aadae6c351f5
4
- data.tar.gz: e313ae7d2df70788f4786afab00ac7fc96d3268d
3
+ metadata.gz: 4572af0f905157b8a8540b7c4fac70426908926c
4
+ data.tar.gz: 7fc82fc4c45831589b5de1d041cab1e651783447
5
5
  SHA512:
6
- metadata.gz: 7fb8c0e56ba54150d0e294eed76572bef85075ef003d5cda31c3d70b0a95bc845341e4f509831afe521623ce4e61cb23c0492caf6938fcb1e32e92da712eae70
7
- data.tar.gz: f21e03e8faf80523154bf119cf9b6d742bcc29337442ede7fa4ae69c95879e802af088218fa5b946bd08c35f38f4a0c6fcd3592c5223fdfe60d849875fcc5c3b
6
+ metadata.gz: bb272c8509fce56497c5863feb5879428cab9d90e42243c791caf14928e11a40f1a3c07af10574028be601874f49a26560354c85d4f561b5fb22d9258e79e944
7
+ data.tar.gz: c053957f581dbcb37aa77c8c7cdce51193ec073927abaa43832e9ad4330a8d8d60de45ab671cf4a48dacf24a4dddbc576b743abc02c6019979bd5901257f4556
data/.gitignore CHANGED
@@ -8,3 +8,4 @@
8
8
  /spec/reports/
9
9
  /tmp/
10
10
  gemfiles/.bundle
11
+ gemfiles/*.gemfile.lock
@@ -1,8 +1,9 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.2.5
4
- - 2.3.3
5
- - 2.4.1
3
+ - 2.3.8
4
+ - 2.4.5
5
+ - 2.5.3
6
+ - 2.6.1
6
7
  addons:
7
8
  postgresql: '9.4'
8
9
  before_install:
data/README.md CHANGED
@@ -1,10 +1,10 @@
1
1
  # JSONb Accessor
2
2
 
3
- Created by &nbsp;&nbsp;&nbsp; [<img src="https://raw.githubusercontent.com/devmynd/jsonb_accessor/master/devmynd-logo.png" alt="DevMynd Logo" />](https://www.devmynd.com/)
3
+ Created by &nbsp;&nbsp;&nbsp; [<img src="https://raw.githubusercontent.com/madeintandem/jsonb_accessor/master/tandem-logo.png" alt="Tandem Logo" />](https://www.madeintandem.com/)
4
4
 
5
- [![Gem Version](https://badge.fury.io/rb/jsonb_accessor.svg)](http://badge.fury.io/rb/jsonb_accessor) &nbsp;&nbsp;&nbsp;[![Build Status](https://travis-ci.org/devmynd/jsonb_accessor.svg)](https://travis-ci.org/devmynd/jsonb_accessor) <img src="https://raw.githubusercontent.com/devmynd/jsonb_accessor/master/json-bee.png" alt="JSONb Accessor Logo" align="right" />
5
+ [![Gem Version](https://badge.fury.io/rb/jsonb_accessor.svg)](http://badge.fury.io/rb/jsonb_accessor) &nbsp;&nbsp;&nbsp;[![Build Status](https://travis-ci.org/madeintandem/jsonb_accessor.svg)](https://travis-ci.org/madeintandem/jsonb_accessor) <img src="https://raw.githubusercontent.com/madeintandem/jsonb_accessor/master/json-bee.png" alt="JSONb Accessor Logo" align="right" />
6
6
 
7
- Adds typed `jsonb` backed fields as first class citizens to your `ActiveRecord` models. This gem is similar in spirit to [HstoreAccessor](https://github.com/devmynd/hstore_accessor), but the `jsonb` column in PostgreSQL has a few distinct advantages, mostly around nested documents and support for collections.
7
+ Adds typed `jsonb` backed fields as first class citizens to your `ActiveRecord` models. This gem is similar in spirit to [HstoreAccessor](https://github.com/madeintandem/hstore_accessor), but the `jsonb` column in PostgreSQL has a few distinct advantages, mostly around nested documents and support for collections.
8
8
 
9
9
  It also adds generic scopes for querying `jsonb` columns.
10
10
 
@@ -309,7 +309,7 @@ From here any attributes specific to any sub-class can be stored in the
309
309
  individual fields in an `jsonb` column.
310
310
 
311
311
  This approach was originally conceived by Joe Hirn in [this blog
312
- post](http://www.devmynd.com/blog/2013-3-single-table-inheritance-hstore-lovely-combination).
312
+ post](https://madeintandem.com/blog/2013-3-single-table-inheritance-hstore-lovely-combination/).
313
313
 
314
314
  ## Validations
315
315
 
@@ -334,7 +334,7 @@ Run `bin/console` for an interactive prompt that will allow you to experiment.
334
334
 
335
335
  ## Contributing
336
336
 
337
- 1. [Fork it](https://github.com/devmynd/jsonb_accessor/fork)
337
+ 1. [Fork it](https://github.com/madeintandem/jsonb_accessor/fork)
338
338
  2. Create your feature branch (`git checkout -b my-new-feature`)
339
339
  3. Add tests and changes (run the tests with `rake`)
340
340
  4. Commit your changes (`git commit -am 'Add some feature'`)
@@ -27,13 +27,13 @@ Gem::Specification.new do |spec|
27
27
  spec.add_dependency "pg", ">= 0.18.1"
28
28
 
29
29
  spec.add_development_dependency "appraisal", "~> 2.2.0"
30
- spec.add_development_dependency "bundler", "~> 1.15.0"
30
+ spec.add_development_dependency "bundler", "~> 2.1.4"
31
31
  spec.add_development_dependency "database_cleaner", "~> 1.6.0"
32
32
  spec.add_development_dependency "awesome_print"
33
33
  spec.add_development_dependency "pry"
34
34
  spec.add_development_dependency "pry-doc"
35
35
  spec.add_development_dependency "pry-nav"
36
- spec.add_development_dependency "rake", "~> 10.0"
36
+ spec.add_development_dependency "rake", ">= 12.3.3"
37
37
  spec.add_development_dependency "rspec", "~> 3.6.0"
38
38
  spec.add_development_dependency "rubocop", "~> 0.48.1"
39
39
  spec.add_development_dependency "standalone_migrations", "~> 5.2.0"
@@ -88,9 +88,11 @@ module JsonbAccessor
88
88
  jsonb_values = public_send(jsonb_attribute) || {}
89
89
  jsonb_values.each do |store_key, value|
90
90
  name = names_and_store_keys.key(store_key)
91
- write_attribute(name, value) if name
91
+ next unless name
92
+
93
+ write_attribute(name, value)
94
+ clear_attribute_change(name) if persisted?
92
95
  end
93
- clear_changes_information if persisted?
94
96
  end
95
97
  end
96
98
 
@@ -81,7 +81,7 @@ module JsonbAccessor
81
81
  JsonbAccessor::QueryHelper.validate_column_name!(all, column_name)
82
82
  JsonbAccessor::QueryHelper.validate_field_name!(all, column_name, field_name)
83
83
  JsonbAccessor::QueryHelper.validate_direction!(direction)
84
- order("(#{table_name}.#{column_name} -> '#{field_name}') #{direction}")
84
+ order(Arel.sql("(#{table_name}.#{column_name} -> '#{field_name}') #{direction}"))
85
85
  end)
86
86
  end
87
87
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module JsonbAccessor
4
- VERSION = "1.0.0"
4
+ VERSION = "1.1.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jsonb_accessor
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Crismali
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2017-08-26 00:00:00.000000000 Z
13
+ date: 2020-06-29 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activerecord
@@ -74,14 +74,14 @@ dependencies:
74
74
  requirements:
75
75
  - - "~>"
76
76
  - !ruby/object:Gem::Version
77
- version: 1.15.0
77
+ version: 2.1.4
78
78
  type: :development
79
79
  prerelease: false
80
80
  version_requirements: !ruby/object:Gem::Requirement
81
81
  requirements:
82
82
  - - "~>"
83
83
  - !ruby/object:Gem::Version
84
- version: 1.15.0
84
+ version: 2.1.4
85
85
  - !ruby/object:Gem::Dependency
86
86
  name: database_cleaner
87
87
  requirement: !ruby/object:Gem::Requirement
@@ -156,16 +156,16 @@ dependencies:
156
156
  name: rake
157
157
  requirement: !ruby/object:Gem::Requirement
158
158
  requirements:
159
- - - "~>"
159
+ - - ">="
160
160
  - !ruby/object:Gem::Version
161
- version: '10.0'
161
+ version: 12.3.3
162
162
  type: :development
163
163
  prerelease: false
164
164
  version_requirements: !ruby/object:Gem::Requirement
165
165
  requirements:
166
- - - "~>"
166
+ - - ">="
167
167
  - !ruby/object:Gem::Version
168
- version: '10.0'
168
+ version: 12.3.3
169
169
  - !ruby/object:Gem::Dependency
170
170
  name: rspec
171
171
  requirement: !ruby/object:Gem::Requirement
@@ -235,9 +235,7 @@ files:
235
235
  - db/migrate/20150407031737_set_up_testing_db.rb
236
236
  - db/schema.rb
237
237
  - gemfiles/activerecord_5.0.0.gemfile
238
- - gemfiles/activerecord_5.0.0.gemfile.lock
239
238
  - gemfiles/activerecord_5.1.0.gemfile
240
- - gemfiles/activerecord_5.1.0.gemfile.lock
241
239
  - jsonb_accessor.gemspec
242
240
  - lib/jsonb_accessor.rb
243
241
  - lib/jsonb_accessor/macro.rb
@@ -1,139 +0,0 @@
1
- PATH
2
- remote: ..
3
- specs:
4
- jsonb_accessor (1.0.0)
5
- activerecord (>= 5.0)
6
- activesupport (>= 5.0)
7
- pg (>= 0.18.1)
8
-
9
- GEM
10
- remote: https://rubygems.org/
11
- specs:
12
- actionpack (5.0.5)
13
- actionview (= 5.0.5)
14
- activesupport (= 5.0.5)
15
- rack (~> 2.0)
16
- rack-test (~> 0.6.3)
17
- rails-dom-testing (~> 2.0)
18
- rails-html-sanitizer (~> 1.0, >= 1.0.2)
19
- actionview (5.0.5)
20
- activesupport (= 5.0.5)
21
- builder (~> 3.1)
22
- erubis (~> 2.7.0)
23
- rails-dom-testing (~> 2.0)
24
- rails-html-sanitizer (~> 1.0, >= 1.0.3)
25
- activemodel (5.0.5)
26
- activesupport (= 5.0.5)
27
- activerecord (5.0.5)
28
- activemodel (= 5.0.5)
29
- activesupport (= 5.0.5)
30
- arel (~> 7.0)
31
- activesupport (5.0.5)
32
- concurrent-ruby (~> 1.0, >= 1.0.2)
33
- i18n (~> 0.7)
34
- minitest (~> 5.1)
35
- tzinfo (~> 1.1)
36
- appraisal (2.2.0)
37
- bundler
38
- rake
39
- thor (>= 0.14.0)
40
- arel (7.1.4)
41
- ast (2.3.0)
42
- awesome_print (1.8.0)
43
- builder (3.2.3)
44
- coderay (1.1.1)
45
- concurrent-ruby (1.0.5)
46
- database_cleaner (1.6.1)
47
- diff-lcs (1.3)
48
- erubis (2.7.0)
49
- i18n (0.8.6)
50
- loofah (2.0.3)
51
- nokogiri (>= 1.5.9)
52
- method_source (0.8.2)
53
- mini_portile2 (2.2.0)
54
- minitest (5.10.3)
55
- nokogiri (1.8.0)
56
- mini_portile2 (~> 2.2.0)
57
- parser (2.4.0.0)
58
- ast (~> 2.2)
59
- pg (0.21.0)
60
- powerpack (0.1.1)
61
- pry (0.10.4)
62
- coderay (~> 1.1.0)
63
- method_source (~> 0.8.1)
64
- slop (~> 3.4)
65
- pry-doc (0.11.1)
66
- pry (~> 0.9)
67
- yard (~> 0.9)
68
- pry-nav (0.2.4)
69
- pry (>= 0.9.10, < 0.11.0)
70
- rack (2.0.3)
71
- rack-test (0.6.3)
72
- rack (>= 1.0)
73
- rails-dom-testing (2.0.3)
74
- activesupport (>= 4.2.0)
75
- nokogiri (>= 1.6)
76
- rails-html-sanitizer (1.0.3)
77
- loofah (~> 2.0)
78
- railties (5.0.5)
79
- actionpack (= 5.0.5)
80
- activesupport (= 5.0.5)
81
- method_source
82
- rake (>= 0.8.7)
83
- thor (>= 0.18.1, < 2.0)
84
- rainbow (2.2.2)
85
- rake
86
- rake (10.5.0)
87
- rspec (3.6.0)
88
- rspec-core (~> 3.6.0)
89
- rspec-expectations (~> 3.6.0)
90
- rspec-mocks (~> 3.6.0)
91
- rspec-core (3.6.0)
92
- rspec-support (~> 3.6.0)
93
- rspec-expectations (3.6.0)
94
- diff-lcs (>= 1.2.0, < 2.0)
95
- rspec-support (~> 3.6.0)
96
- rspec-mocks (3.6.0)
97
- diff-lcs (>= 1.2.0, < 2.0)
98
- rspec-support (~> 3.6.0)
99
- rspec-support (3.6.0)
100
- rubocop (0.48.1)
101
- parser (>= 2.3.3.1, < 3.0)
102
- powerpack (~> 0.1)
103
- rainbow (>= 1.99.1, < 3.0)
104
- ruby-progressbar (~> 1.7)
105
- unicode-display_width (~> 1.0, >= 1.0.1)
106
- ruby-progressbar (1.8.1)
107
- slop (3.6.0)
108
- standalone_migrations (5.2.3)
109
- activerecord (>= 4.2.7, < 5.2.0)
110
- railties (>= 4.2.7, < 5.2.0)
111
- rake (>= 10.0)
112
- thor (0.20.0)
113
- thread_safe (0.3.6)
114
- tzinfo (1.2.3)
115
- thread_safe (~> 0.1)
116
- unicode-display_width (1.3.0)
117
- yard (0.9.9)
118
-
119
- PLATFORMS
120
- ruby
121
-
122
- DEPENDENCIES
123
- activerecord (~> 5.0.0)
124
- appraisal (~> 2.2.0)
125
- awesome_print
126
- bundler (~> 1.15.0)
127
- database_cleaner (~> 1.6.0)
128
- jsonb_accessor!
129
- pg
130
- pry
131
- pry-doc
132
- pry-nav
133
- rake (~> 10.0)
134
- rspec (~> 3.6.0)
135
- rubocop (~> 0.48.1)
136
- standalone_migrations (~> 5.2.0)
137
-
138
- BUNDLED WITH
139
- 1.15.4
@@ -1,139 +0,0 @@
1
- PATH
2
- remote: ..
3
- specs:
4
- jsonb_accessor (1.0.0)
5
- activerecord (>= 5.0)
6
- activesupport (>= 5.0)
7
- pg (>= 0.18.1)
8
-
9
- GEM
10
- remote: https://rubygems.org/
11
- specs:
12
- actionpack (5.1.3)
13
- actionview (= 5.1.3)
14
- activesupport (= 5.1.3)
15
- rack (~> 2.0)
16
- rack-test (~> 0.6.3)
17
- rails-dom-testing (~> 2.0)
18
- rails-html-sanitizer (~> 1.0, >= 1.0.2)
19
- actionview (5.1.3)
20
- activesupport (= 5.1.3)
21
- builder (~> 3.1)
22
- erubi (~> 1.4)
23
- rails-dom-testing (~> 2.0)
24
- rails-html-sanitizer (~> 1.0, >= 1.0.3)
25
- activemodel (5.1.3)
26
- activesupport (= 5.1.3)
27
- activerecord (5.1.3)
28
- activemodel (= 5.1.3)
29
- activesupport (= 5.1.3)
30
- arel (~> 8.0)
31
- activesupport (5.1.3)
32
- concurrent-ruby (~> 1.0, >= 1.0.2)
33
- i18n (~> 0.7)
34
- minitest (~> 5.1)
35
- tzinfo (~> 1.1)
36
- appraisal (2.2.0)
37
- bundler
38
- rake
39
- thor (>= 0.14.0)
40
- arel (8.0.0)
41
- ast (2.3.0)
42
- awesome_print (1.8.0)
43
- builder (3.2.3)
44
- coderay (1.1.1)
45
- concurrent-ruby (1.0.5)
46
- database_cleaner (1.6.1)
47
- diff-lcs (1.3)
48
- erubi (1.6.1)
49
- i18n (0.8.6)
50
- loofah (2.0.3)
51
- nokogiri (>= 1.5.9)
52
- method_source (0.8.2)
53
- mini_portile2 (2.2.0)
54
- minitest (5.10.3)
55
- nokogiri (1.8.0)
56
- mini_portile2 (~> 2.2.0)
57
- parser (2.4.0.0)
58
- ast (~> 2.2)
59
- pg (0.21.0)
60
- powerpack (0.1.1)
61
- pry (0.10.4)
62
- coderay (~> 1.1.0)
63
- method_source (~> 0.8.1)
64
- slop (~> 3.4)
65
- pry-doc (0.11.1)
66
- pry (~> 0.9)
67
- yard (~> 0.9)
68
- pry-nav (0.2.4)
69
- pry (>= 0.9.10, < 0.11.0)
70
- rack (2.0.3)
71
- rack-test (0.6.3)
72
- rack (>= 1.0)
73
- rails-dom-testing (2.0.3)
74
- activesupport (>= 4.2.0)
75
- nokogiri (>= 1.6)
76
- rails-html-sanitizer (1.0.3)
77
- loofah (~> 2.0)
78
- railties (5.1.3)
79
- actionpack (= 5.1.3)
80
- activesupport (= 5.1.3)
81
- method_source
82
- rake (>= 0.8.7)
83
- thor (>= 0.18.1, < 2.0)
84
- rainbow (2.2.2)
85
- rake
86
- rake (10.5.0)
87
- rspec (3.6.0)
88
- rspec-core (~> 3.6.0)
89
- rspec-expectations (~> 3.6.0)
90
- rspec-mocks (~> 3.6.0)
91
- rspec-core (3.6.0)
92
- rspec-support (~> 3.6.0)
93
- rspec-expectations (3.6.0)
94
- diff-lcs (>= 1.2.0, < 2.0)
95
- rspec-support (~> 3.6.0)
96
- rspec-mocks (3.6.0)
97
- diff-lcs (>= 1.2.0, < 2.0)
98
- rspec-support (~> 3.6.0)
99
- rspec-support (3.6.0)
100
- rubocop (0.48.1)
101
- parser (>= 2.3.3.1, < 3.0)
102
- powerpack (~> 0.1)
103
- rainbow (>= 1.99.1, < 3.0)
104
- ruby-progressbar (~> 1.7)
105
- unicode-display_width (~> 1.0, >= 1.0.1)
106
- ruby-progressbar (1.8.1)
107
- slop (3.6.0)
108
- standalone_migrations (5.2.3)
109
- activerecord (>= 4.2.7, < 5.2.0)
110
- railties (>= 4.2.7, < 5.2.0)
111
- rake (>= 10.0)
112
- thor (0.20.0)
113
- thread_safe (0.3.6)
114
- tzinfo (1.2.3)
115
- thread_safe (~> 0.1)
116
- unicode-display_width (1.3.0)
117
- yard (0.9.9)
118
-
119
- PLATFORMS
120
- ruby
121
-
122
- DEPENDENCIES
123
- activerecord (~> 5.1.3)
124
- appraisal (~> 2.2.0)
125
- awesome_print
126
- bundler (~> 1.15.0)
127
- database_cleaner (~> 1.6.0)
128
- jsonb_accessor!
129
- pg
130
- pry
131
- pry-doc
132
- pry-nav
133
- rake (~> 10.0)
134
- rspec (~> 3.6.0)
135
- rubocop (~> 0.48.1)
136
- standalone_migrations (~> 5.2.0)
137
-
138
- BUNDLED WITH
139
- 1.15.4