dekorator 1.1.0 → 1.2.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
  SHA256:
3
- metadata.gz: b54b4599f372c2cf35b0ac966ef4491374af34cb11a02081ed94c1e98b54d5ba
4
- data.tar.gz: 816309b5406ab7f95b2468e9a3c1b16fcdc1f6e7e09994cef4f055d252eafa76
3
+ metadata.gz: 3da5195ec703cf974bb139df0433fec47aa1b5a61a905aa807868f52e0d48a88
4
+ data.tar.gz: 7cbcc777caf8dba2c9d205abcd009979be7d9f1a537fba9e7a0358f06c82e502
5
5
  SHA512:
6
- metadata.gz: 0fc9fed3fab894d17a0f1436c169b36cdfddab34d32e73e749458092731b921c295ed1d9d48963117df81518f88fde9f716fe81017eccbe6890e47d99b33f355
7
- data.tar.gz: 299d6600c2320b28543c64c8252d2b6fa6b8714087dcbd2f59d3e79da8441b05786d17b36a441e9079dc6845a9c89c485c6a5deda4022943036b54738429656c
6
+ metadata.gz: 885470910d0a93c41f21c12d8c367e12d7d216955b9d838a9a5c58cf3bba144025229c33e88f9d956e0daeed3edd901802204b745e49c6620e989a25940eb0f6
7
+ data.tar.gz: 3f2e77e1608d254cd92faaadc70ac378859d5094c37e2de573836329217579e38dac4d0b75a252a346a2830655b8d276b644719b8cd0d72f6fd82749f7535756
@@ -20,15 +20,14 @@ jobs:
20
20
  - { ruby: "2.6", rails: "6.1.x" }
21
21
  - { ruby: "2.7", rails: "6.1.x" }
22
22
  - { ruby: "3.0", rails: "6.1.x" }
23
+ - { ruby: "2.7", rails: "head" }
24
+ - { ruby: "3.0", rails: "head" }
23
25
 
24
- steps:
25
- - uses: actions/checkout@v1
26
26
 
27
- - uses: actions/cache@v1
28
- id: cache
29
- with:
30
- path: gemfiles/vendor/bundle
31
- key: ruby-${{ matrix.versions.ruby }}-rails-${{ matrix.versions.rails }}
27
+ env:
28
+ BUNDLE_GEMFILE: gemfiles/rails_${{ matrix.versions.rails }}.gemfile
29
+ steps:
30
+ - uses: actions/checkout@v2
32
31
 
33
32
  - name: Set up Ruby
34
33
  uses: ruby/setup-ruby@v1
@@ -36,17 +35,6 @@ jobs:
36
35
  ruby-version: ${{ matrix.versions.ruby }}
37
36
  bundler-cache: true
38
37
 
39
- - name: Set up bundler
40
- run: |
41
- echo 'gem: --no-document' >> ~/.gemrc
42
- gem install bundler
43
- bundle config --global gemfile gemfiles/rails_${{ matrix.versions.rails }}.gemfile
44
- bundle config --global path vendor/bundle
45
-
46
- - name: Install gems
47
- run: |
48
- bundle install --jobs $(nproc) --retry 3
49
-
50
38
  - name: Test with Rake
51
39
  run: |
52
40
  bundle exec rake test:all_with_coverage
data/CHANGELOG.md CHANGED
@@ -8,6 +8,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
8
8
  ## [Unreleased]
9
9
  Nothing yet
10
10
 
11
+ ## [1.2.0] - 2021-10-14
12
+ ### Added
13
+ - Add Rails 7.0 support ([#43](https://github.com/komposable/dekorator/pull/43))
14
+ ### Fixes
15
+ - Avoid n+1 queries when decorate ActiveRecord::Relation ([#44](https://github.com/komposable/dekorator/pull/44))
16
+
11
17
  ## [1.1.0] - 2020-12-23
12
18
  ### Added
13
19
  - Ruby 2.7 support ([#37](https://github.com/komposable/dekorator/pull/37))
@@ -40,6 +46,7 @@ Nothing yet
40
46
  - Create `dekorator:install` generator ([a2a36d66](https://github.com/komposable/dekorator/commit/a2a36d66c6de6cb0a00f783794cd29f899bc04b6))
41
47
  - Create `decorator` generator ([a2a36d66](https://github.com/komposable/dekorator/commit/a2a36d66c6de6cb0a00f783794cd29f899bc04b6))
42
48
 
43
- [Unreleased]: https://github.com/komposable/dekorator/compare/v1.1.0...master
49
+ [Unreleased]: https://github.com/komposable/dekorator/compare/v1.2.0...master
50
+ [1.2.0]: https://github.com/komposable/dekorator/compare/v1.1.0...v1.2.0
44
51
  [1.1.0]: https://github.com/komposable/dekorator/compare/v1.0.0...v1.1.0
45
52
  [1.0.0]: https://github.com/komposable/dekorator/compare/v1.0.0.pre.1...v1.0.0
data/dekorator.gemspec CHANGED
@@ -37,9 +37,10 @@ Gem::Specification.new do |spec|
37
37
 
38
38
  spec.required_ruby_version = ">= 2.3"
39
39
 
40
- spec.add_runtime_dependency "actionview", ">= 5.2", "< 6.2"
41
- spec.add_runtime_dependency "activesupport", ">= 5.2", "< 6.2"
42
- spec.add_runtime_dependency "railties", ">= 5.2", "< 6.2"
40
+ spec.add_runtime_dependency "actionview", ">= 5.2", "< 7.1"
41
+ spec.add_runtime_dependency "activerecord", ">= 5.2", "< 7.1"
42
+ spec.add_runtime_dependency "activesupport", ">= 5.2", "< 7.1"
43
+ spec.add_runtime_dependency "railties", ">= 5.2", "< 7.1"
43
44
 
44
45
  spec.add_development_dependency "bundler", "~> 2.0"
45
46
  spec.add_development_dependency "rake", ">= 12.3.3"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Dekorator
4
- VERSION = "1.1.0".freeze
4
+ VERSION = "1.2.0".freeze
5
5
  end
data/lib/dekorator.rb CHANGED
@@ -89,6 +89,10 @@ module Dekorator
89
89
 
90
90
  # @api private
91
91
  def decorable?(object_or_enumerable)
92
+ return false if defined?(ActiveRecord::Relation) \
93
+ && object_or_enumerable.is_a?(ActiveRecord::Relation) \
94
+ && object_or_enumerable.blank?
95
+
92
96
  return false if object_or_enumerable.respond_to?(:empty?) && object_or_enumerable.empty?
93
97
  return false if !object_or_enumerable
94
98
  return false if object_or_enumerable.is_a?(Dekorator::Base)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dekorator
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pantographe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-12-23 00:00:00.000000000 Z
11
+ date: 2021-10-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionview
@@ -19,7 +19,7 @@ dependencies:
19
19
  version: '5.2'
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '6.2'
22
+ version: '7.1'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,7 +29,27 @@ dependencies:
29
29
  version: '5.2'
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '6.2'
32
+ version: '7.1'
33
+ - !ruby/object:Gem::Dependency
34
+ name: activerecord
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '5.2'
40
+ - - "<"
41
+ - !ruby/object:Gem::Version
42
+ version: '7.1'
43
+ type: :runtime
44
+ prerelease: false
45
+ version_requirements: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: '5.2'
50
+ - - "<"
51
+ - !ruby/object:Gem::Version
52
+ version: '7.1'
33
53
  - !ruby/object:Gem::Dependency
34
54
  name: activesupport
35
55
  requirement: !ruby/object:Gem::Requirement
@@ -39,7 +59,7 @@ dependencies:
39
59
  version: '5.2'
40
60
  - - "<"
41
61
  - !ruby/object:Gem::Version
42
- version: '6.2'
62
+ version: '7.1'
43
63
  type: :runtime
44
64
  prerelease: false
45
65
  version_requirements: !ruby/object:Gem::Requirement
@@ -49,7 +69,7 @@ dependencies:
49
69
  version: '5.2'
50
70
  - - "<"
51
71
  - !ruby/object:Gem::Version
52
- version: '6.2'
72
+ version: '7.1'
53
73
  - !ruby/object:Gem::Dependency
54
74
  name: railties
55
75
  requirement: !ruby/object:Gem::Requirement
@@ -59,7 +79,7 @@ dependencies:
59
79
  version: '5.2'
60
80
  - - "<"
61
81
  - !ruby/object:Gem::Version
62
- version: '6.2'
82
+ version: '7.1'
63
83
  type: :runtime
64
84
  prerelease: false
65
85
  version_requirements: !ruby/object:Gem::Requirement
@@ -69,7 +89,7 @@ dependencies:
69
89
  version: '5.2'
70
90
  - - "<"
71
91
  - !ruby/object:Gem::Version
72
- version: '6.2'
92
+ version: '7.1'
73
93
  - !ruby/object:Gem::Dependency
74
94
  name: bundler
75
95
  requirement: !ruby/object:Gem::Requirement
@@ -167,7 +187,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
167
187
  - !ruby/object:Gem::Version
168
188
  version: '0'
169
189
  requirements: []
170
- rubygems_version: 3.2.2
190
+ rubygems_version: 3.2.9
171
191
  signing_key:
172
192
  specification_version: 4
173
193
  summary: An opinionated way of organizing model-view code in Ruby on Rails, based