active_decorator 1.3.1 → 1.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +7 -0
- data/.github/workflows/main.yml +88 -0
- data/CHANGELOG.md +28 -0
- data/Gemfile +25 -0
- data/README.md +4 -4
- data/Rakefile +1 -1
- data/active_decorator.gemspec +3 -4
- data/lib/active_decorator/decorator.rb +40 -36
- data/lib/active_decorator/helpers.rb +1 -0
- data/lib/active_decorator/monkey/action_controller/base/rescue_from.rb +2 -2
- data/lib/active_decorator/monkey/action_view/collection_renderer.rb +12 -0
- data/lib/active_decorator/monkey/action_view/object_renderer.rb +12 -0
- data/lib/active_decorator/monkey/action_view/partial_renderer.rb +20 -8
- data/lib/active_decorator/railtie.rb +8 -0
- data/lib/active_decorator/version.rb +1 -1
- data/lib/generators/rspec/templates/decorator_spec.rb +1 -1
- metadata +11 -88
- data/.travis.yml +0 -79
- data/gemfiles/Gemfile-rails.4.2.x +0 -7
- data/gemfiles/Gemfile-rails.5.0.x +0 -6
- data/gemfiles/Gemfile-rails.5.1.x +0 -5
- data/gemfiles/Gemfile-rails.5.2.x +0 -5
- data/gemfiles/Gemfile-rails.6.0.x +0 -5
- data/gemfiles/Gemfile-rails.edge +0 -12
- data/test/configuration_test.rb +0 -28
- data/test/controllers/fake_detection_test.rb +0 -14
- data/test/decorator_test.rb +0 -58
- data/test/fake_app/app/decorators/comic_decorator.rb +0 -5
- data/test/fake_app/app/views/api/bookstores/show.json.jbuilder +0 -1
- data/test/fake_app/app/views/authors/index.html.erb +0 -16
- data/test/fake_app/app/views/authors/show.html.erb +0 -10
- data/test/fake_app/app/views/authors/show.json.jbuilder +0 -2
- data/test/fake_app/app/views/book_mailer/thanks.text.erb +0 -1
- data/test/fake_app/app/views/books/_book.html.erb +0 -2
- data/test/fake_app/app/views/books/_book.json.jbuilder +0 -2
- data/test/fake_app/app/views/books/_book_locals.html.erb +0 -2
- data/test/fake_app/app/views/books/errata.html.erb +0 -1
- data/test/fake_app/app/views/books/errata2.html.erb +0 -1
- data/test/fake_app/app/views/books/error.html.erb +0 -1
- data/test/fake_app/app/views/books/index.html.erb +0 -4
- data/test/fake_app/app/views/books/purchase.html.erb +0 -1
- data/test/fake_app/app/views/books/show.html.erb +0 -4
- data/test/fake_app/app/views/movies/show.html.erb +0 -2
- data/test/fake_app/fake_app.rb +0 -283
- data/test/fake_app/public/images/cover.png +0 -0
- data/test/features/action_controller_api_test.rb +0 -19
- data/test/features/action_view_helpers_test.rb +0 -38
- data/test/features/association_test.rb +0 -41
- data/test/features/controller_ivar_test.rb +0 -41
- data/test/features/jbuilder_test.rb +0 -16
- data/test/features/name_error_handling_test.rb +0 -29
- data/test/features/partial_test.rb +0 -29
- data/test/models/association_test.rb +0 -75
- data/test/test_helper.rb +0 -52
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 23b742ea8c0e64545e2ad4249061b4f459f73f8012c9313d5900b5011399169d
|
|
4
|
+
data.tar.gz: 58b7e4519a166264d6565d04ae593309da02c026240164f01a9dbe3795b100a3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 23f24b4acbb2c9cfdbfb6c4c6ce7f6aafba6924bab0fc924b7ebeb51f9dad4ffbb5bb8280f9b7f12a51fbcb1cd0be859e6d7621cf4092d344afce85536364a16
|
|
7
|
+
data.tar.gz: 4e4938a409750f666a0bffacd411c82d33e79b247acd221c9f62ac150e00dc12a361e9e3bc7dbd151aeaccacafe165348621b927c10ab5e2c15ddec4c895c79d
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
name: build
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
pull_request:
|
|
6
|
+
schedule:
|
|
7
|
+
- cron: '45 23 * * *'
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
build:
|
|
11
|
+
name: Ruby ${{ matrix.ruby_version }} / Rails ${{ matrix.rails_version }}${{ matrix.api == '1' && ' / API' || '' }}
|
|
12
|
+
strategy:
|
|
13
|
+
matrix:
|
|
14
|
+
ruby_version: [ruby-head, '3.2', '3.1', '3.0', '2.7']
|
|
15
|
+
rails_version: [edge, '7.0', '6.1']
|
|
16
|
+
api: ['0', '1']
|
|
17
|
+
|
|
18
|
+
include:
|
|
19
|
+
- ruby_version: '2.7'
|
|
20
|
+
rails_version: '6.0'
|
|
21
|
+
- ruby_version: '2.7'
|
|
22
|
+
rails_version: '6.0'
|
|
23
|
+
api: '1'
|
|
24
|
+
|
|
25
|
+
- ruby_version: '2.6'
|
|
26
|
+
rails_version: '6.1'
|
|
27
|
+
- ruby_version: '2.6'
|
|
28
|
+
rails_version: '6.1'
|
|
29
|
+
api: '1'
|
|
30
|
+
- ruby_version: '2.6'
|
|
31
|
+
rails_version: '6.0'
|
|
32
|
+
- ruby_version: '2.6'
|
|
33
|
+
rails_version: '6.0'
|
|
34
|
+
api: '1'
|
|
35
|
+
- ruby_version: '2.6'
|
|
36
|
+
rails_version: '5.2'
|
|
37
|
+
- ruby_version: '2.6'
|
|
38
|
+
rails_version: '5.2'
|
|
39
|
+
api: '1'
|
|
40
|
+
- ruby_version: '2.6'
|
|
41
|
+
rails_version: '5.1'
|
|
42
|
+
- ruby_version: '2.6'
|
|
43
|
+
rails_version: '5.1'
|
|
44
|
+
api: '1'
|
|
45
|
+
- ruby_version: '2.6'
|
|
46
|
+
rails_version: '5.0'
|
|
47
|
+
- ruby_version: '2.6'
|
|
48
|
+
rails_version: '5.0'
|
|
49
|
+
api: '1'
|
|
50
|
+
|
|
51
|
+
- ruby_version: '2.5'
|
|
52
|
+
rails_version: '5.2'
|
|
53
|
+
|
|
54
|
+
- ruby_version: '2.4'
|
|
55
|
+
rails_version: '5.2'
|
|
56
|
+
|
|
57
|
+
- ruby_version: '2.3'
|
|
58
|
+
rails_version: '5.2'
|
|
59
|
+
- ruby_version: '2.3'
|
|
60
|
+
rails_version: '4.2'
|
|
61
|
+
bundler_version: '1'
|
|
62
|
+
|
|
63
|
+
- ruby_version: '2.2'
|
|
64
|
+
rails_version: '5.2'
|
|
65
|
+
|
|
66
|
+
- ruby_version: '2.1'
|
|
67
|
+
rails_version: '4.2'
|
|
68
|
+
bundler_version: '1'
|
|
69
|
+
|
|
70
|
+
env:
|
|
71
|
+
RAILS_VERSION: ${{ matrix.rails_version }}
|
|
72
|
+
API: ${{ matrix.api }}
|
|
73
|
+
|
|
74
|
+
runs-on: ubuntu-20.04
|
|
75
|
+
|
|
76
|
+
steps:
|
|
77
|
+
- uses: actions/checkout@v3
|
|
78
|
+
|
|
79
|
+
- uses: ruby/setup-ruby@v1
|
|
80
|
+
with:
|
|
81
|
+
ruby-version: ${{ matrix.ruby_version }}
|
|
82
|
+
rubygems: ${{ matrix.ruby_version < '2.6' && 'default' || 'latest' }}
|
|
83
|
+
bundler: ${{ matrix.bundler_version }}
|
|
84
|
+
bundler-cache: true
|
|
85
|
+
continue-on-error: ${{ matrix.allow_failures == 'true' }}
|
|
86
|
+
|
|
87
|
+
- run: bundle exec rake
|
|
88
|
+
continue-on-error: ${{ matrix.allow_failures == 'true' }}
|
data/CHANGELOG.md
CHANGED
|
@@ -1,7 +1,35 @@
|
|
|
1
|
+
## 1.4.1
|
|
2
|
+
|
|
3
|
+
* Support Ruby 3.2 by `File.exists?` => `File.exists?` in generator [@kyoshidajp]
|
|
4
|
+
|
|
5
|
+
* A little bit of internal code cleanup
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
## 1.4.0
|
|
9
|
+
|
|
10
|
+
* Decorate non-nil objects where `nil?` returns true, namely, ActionText::RichText body [@jamesbrooks]
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
## 1.3.4
|
|
14
|
+
|
|
15
|
+
* Support Rails 6.1 [@y-yagi]
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
## 1.3.3
|
|
19
|
+
|
|
20
|
+
* Fixed Ruby 2.7 keyword arguments warning [@pocke]
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
## 1.3.2
|
|
24
|
+
|
|
25
|
+
* Fixed NameError on ActionController::API controllers without jbuilder enhancement [@kamillle]
|
|
26
|
+
|
|
27
|
+
|
|
1
28
|
## 1.3.1
|
|
2
29
|
|
|
3
30
|
* Switched back from Ruby's `const_get` to Active Support `constantize` for fetching decorator modules, due to inability to properly detect namespaced decorator [@sinsoku]
|
|
4
31
|
|
|
32
|
+
|
|
5
33
|
## 1.3.0
|
|
6
34
|
|
|
7
35
|
* Switched from Active Support `constantize` to Ruby's `const_get` when fetching decorator modules
|
data/Gemfile
CHANGED
|
@@ -3,3 +3,28 @@
|
|
|
3
3
|
source 'https://rubygems.org'
|
|
4
4
|
|
|
5
5
|
gemspec
|
|
6
|
+
|
|
7
|
+
if ENV['RAILS_VERSION'] == 'edge'
|
|
8
|
+
gem 'rails', git: 'https://github.com/rails/rails.git'
|
|
9
|
+
gem 'rackup'
|
|
10
|
+
elsif ENV['RAILS_VERSION']
|
|
11
|
+
gem 'rails', "~> #{ENV['RAILS_VERSION']}.0"
|
|
12
|
+
gem 'sqlite3', '< 1.4' if ENV['RAILS_VERSION'] <= '5.0'
|
|
13
|
+
gem 'rackup' if ENV['RAILS_VERSION'] > '7.1'
|
|
14
|
+
else
|
|
15
|
+
gem 'rails'
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
if RUBY_VERSION < '2.7'
|
|
19
|
+
gem 'puma', '< 6'
|
|
20
|
+
else
|
|
21
|
+
gem 'puma'
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
gem 'nokogiri', RUBY_VERSION < '2.1' ? '~> 1.6.0' : '>= 1.7'
|
|
25
|
+
gem 'loofah', RUBY_VERSION < '2.5' ? '< 2.21.0' : '>= 0'
|
|
26
|
+
gem 'concurrent-ruby', RUBY_VERSION < '2.3' ? '~> 1.1.0' : '>= 1.2'
|
|
27
|
+
gem 'selenium-webdriver', RUBY_VERSION == '3.0' ? '4.9.0' : '>= 0'
|
|
28
|
+
gem 'webdrivers' if ENV['RAILS_VERSION'] && ENV['RAILS_VERSION'] >= '6'
|
|
29
|
+
gem 'net-smtp' if RUBY_VERSION >= '3.1'
|
|
30
|
+
gem 'jbuilder' unless ENV['API'] == '1'
|
data/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
# ActiveDecorator [](https://github.com/amatsuda/active_decorator/actions) [](https://codeclimate.com/github/amatsuda/active_decorator)
|
|
2
2
|
|
|
3
|
-
A simple and Rubyish view helper for Rails 4, Rails 5, and Rails
|
|
3
|
+
A simple and Rubyish view helper for Rails 4, Rails 5, Rails 6, and Rails 7. Keep your helpers and views Object-Oriented!
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
## Features ##
|
|
@@ -15,9 +15,9 @@ A simple and Rubyish view helper for Rails 4, Rails 5, and Rails 6. Keep your he
|
|
|
15
15
|
|
|
16
16
|
## Supported versions ##
|
|
17
17
|
|
|
18
|
-
* Ruby 2.
|
|
18
|
+
* Ruby 2.1.x, 2.2.x, 2.3.x, 2.4.x, 2.5.x, 2.6.x, 2.7.x, 3.0.x, 3.1.x, 3.2.x, and 3.3 (trunk)
|
|
19
19
|
|
|
20
|
-
* Rails 4.2.x, 5.0, 5.1, 5.2,
|
|
20
|
+
* Rails 4.2.x, 5.0, 5.1, 5.2, 6.0, 6.1, 7.0, and 7.1 (edge)
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
## Supported ORMs ##
|
data/Rakefile
CHANGED
data/active_decorator.gemspec
CHANGED
|
@@ -13,9 +13,9 @@ Gem::Specification.new do |s|
|
|
|
13
13
|
s.summary = %q{A simple and Rubyish view helper for Rails}
|
|
14
14
|
s.description = %q{A simple and Rubyish view helper for Rails}
|
|
15
15
|
|
|
16
|
-
s.files =
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
s.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
|
17
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
18
|
+
end
|
|
19
19
|
s.require_paths = ["lib"]
|
|
20
20
|
|
|
21
21
|
s.add_dependency 'activesupport'
|
|
@@ -26,6 +26,5 @@ Gem::Specification.new do |s|
|
|
|
26
26
|
s.add_development_dependency 'capybara'
|
|
27
27
|
s.add_development_dependency 'sqlite3'
|
|
28
28
|
s.add_development_dependency 'rake'
|
|
29
|
-
s.add_development_dependency 'jbuilder'
|
|
30
29
|
s.add_development_dependency 'byebug'
|
|
31
30
|
end
|
|
@@ -9,7 +9,7 @@ module ActiveDecorator
|
|
|
9
9
|
include Singleton
|
|
10
10
|
|
|
11
11
|
def initialize
|
|
12
|
-
|
|
12
|
+
@decorators = {}
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
# Decorates the given object.
|
|
@@ -23,34 +23,26 @@ module ActiveDecorator
|
|
|
23
23
|
#
|
|
24
24
|
# This method can be publicly called from anywhere by `ActiveDecorator::Decorator.instance.decorate(obj)`.
|
|
25
25
|
def decorate(obj)
|
|
26
|
-
return if defined?(Jbuilder) && (Jbuilder === obj)
|
|
27
|
-
return if obj.nil?
|
|
26
|
+
return obj if defined?(Jbuilder) && (Jbuilder === obj)
|
|
28
27
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
end
|
|
37
|
-
elsif defined?(ActiveRecord) && obj.is_a?(ActiveRecord::Relation)
|
|
38
|
-
# don't call each nor to_a immediately
|
|
39
|
-
if obj.respond_to?(:records)
|
|
40
|
-
# Rails 5.0
|
|
41
|
-
obj.extend ActiveDecorator::RelationDecorator unless obj.is_a? ActiveDecorator::RelationDecorator
|
|
42
|
-
else
|
|
43
|
-
# Rails 3.x and 4.x
|
|
44
|
-
obj.extend ActiveDecorator::RelationDecoratorLegacy unless obj.is_a? ActiveDecorator::RelationDecoratorLegacy
|
|
45
|
-
end
|
|
28
|
+
case obj
|
|
29
|
+
when Array
|
|
30
|
+
obj.each {|e| decorate e }
|
|
31
|
+
when Hash
|
|
32
|
+
obj.each_value {|v| decorate v }
|
|
33
|
+
when nil, true, false
|
|
34
|
+
# Do nothing
|
|
46
35
|
else
|
|
47
|
-
if defined?
|
|
48
|
-
obj.
|
|
36
|
+
if defined? ActiveRecord
|
|
37
|
+
if obj.is_a? ActiveRecord::Relation
|
|
38
|
+
return decorate_relation obj
|
|
39
|
+
elsif ActiveRecord::Base === obj
|
|
40
|
+
obj.extend ActiveDecorator::Decorated unless ActiveDecorator::Decorated === obj
|
|
41
|
+
end
|
|
49
42
|
end
|
|
50
43
|
|
|
51
44
|
d = decorator_for obj.class
|
|
52
|
-
|
|
53
|
-
obj.extend d unless obj.is_a? d
|
|
45
|
+
obj.extend d if d && !(d === obj)
|
|
54
46
|
end
|
|
55
47
|
|
|
56
48
|
obj
|
|
@@ -59,45 +51,57 @@ module ActiveDecorator
|
|
|
59
51
|
# Decorates AR model object's association only when the object was decorated.
|
|
60
52
|
# Returns the association instance.
|
|
61
53
|
def decorate_association(owner, target)
|
|
62
|
-
|
|
54
|
+
(ActiveDecorator::Decorated === owner) ? decorate(target) : target
|
|
63
55
|
end
|
|
64
56
|
|
|
65
57
|
private
|
|
66
58
|
# Returns a decorator module for the given class.
|
|
67
59
|
# Returns `nil` if no decorator module was found.
|
|
68
60
|
def decorator_for(model_class)
|
|
69
|
-
return
|
|
61
|
+
return @decorators[model_class] if @decorators.key? model_class
|
|
70
62
|
|
|
71
63
|
decorator_name = "#{model_class.name}#{ActiveDecorator.config.decorator_suffix}"
|
|
72
64
|
d = decorator_name.constantize
|
|
73
65
|
unless Class === d
|
|
74
66
|
d.send :include, ActiveDecorator::Helpers
|
|
75
|
-
|
|
67
|
+
@decorators[model_class] = d
|
|
76
68
|
else
|
|
77
69
|
# Cache nil results
|
|
78
|
-
|
|
70
|
+
@decorators[model_class] = nil
|
|
79
71
|
end
|
|
80
72
|
rescue NameError
|
|
81
73
|
if model_class.respond_to?(:base_class) && (model_class.base_class != model_class)
|
|
82
|
-
|
|
74
|
+
@decorators[model_class] = decorator_for model_class.base_class
|
|
83
75
|
else
|
|
84
76
|
# Cache nil results
|
|
85
|
-
|
|
77
|
+
@decorators[model_class] = nil
|
|
86
78
|
end
|
|
87
79
|
end
|
|
88
|
-
end
|
|
89
80
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
81
|
+
# Decorate with proper monkey patch based on AR version
|
|
82
|
+
def decorate_relation(obj)
|
|
83
|
+
if obj.respond_to?(:records)
|
|
84
|
+
# Rails 5.0
|
|
85
|
+
obj.extend ActiveDecorator::RelationDecorator unless ActiveDecorator::RelationDecorator === obj
|
|
86
|
+
else
|
|
87
|
+
# Rails 3.x and 4.x
|
|
88
|
+
obj.extend ActiveDecorator::RelationDecoratorLegacy unless ActiveDecorator::RelationDecoratorLegacy === obj
|
|
89
|
+
end
|
|
90
|
+
obj
|
|
94
91
|
end
|
|
95
92
|
end
|
|
96
93
|
|
|
97
|
-
#
|
|
94
|
+
# Override AR::Relation#records to decorate each element after being loaded (for AR 5+)
|
|
98
95
|
module RelationDecorator
|
|
99
96
|
def records
|
|
100
97
|
ActiveDecorator::Decorator.instance.decorate super
|
|
101
98
|
end
|
|
102
99
|
end
|
|
100
|
+
|
|
101
|
+
# Override AR::Relation#to_a to decorate each element after being loaded (for AR 3 and 4)
|
|
102
|
+
module RelationDecoratorLegacy
|
|
103
|
+
def to_a
|
|
104
|
+
ActiveDecorator::Decorator.instance.decorate super
|
|
105
|
+
end
|
|
106
|
+
end
|
|
103
107
|
end
|
|
@@ -7,10 +7,10 @@ module ActiveDecorator
|
|
|
7
7
|
module ActionController
|
|
8
8
|
module Base
|
|
9
9
|
def rescue_with_handler(*)
|
|
10
|
-
ActiveDecorator::ViewContext.push(view_context)
|
|
10
|
+
ActiveDecorator::ViewContext.push(view_context) if defined?(view_context)
|
|
11
11
|
super
|
|
12
12
|
ensure
|
|
13
|
-
ActiveDecorator::ViewContext.pop
|
|
13
|
+
ActiveDecorator::ViewContext.pop if defined?(view_context)
|
|
14
14
|
end
|
|
15
15
|
end
|
|
16
16
|
end
|
|
@@ -5,18 +5,30 @@ module ActiveDecorator
|
|
|
5
5
|
module Monkey
|
|
6
6
|
module ActionView
|
|
7
7
|
module PartialRenderer
|
|
8
|
+
if Rails.version.to_f >= 6.1
|
|
9
|
+
def initialize(*)
|
|
10
|
+
super
|
|
11
|
+
|
|
12
|
+
@locals.each_value do |v|
|
|
13
|
+
ActiveDecorator::Decorator.instance.decorate v
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
8
18
|
private
|
|
9
19
|
|
|
10
|
-
|
|
11
|
-
|
|
20
|
+
if Rails.version.to_f < 6.1
|
|
21
|
+
def setup(*)
|
|
22
|
+
super
|
|
12
23
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
24
|
+
@locals.each_value do |v|
|
|
25
|
+
ActiveDecorator::Decorator.instance.decorate v
|
|
26
|
+
end if @locals
|
|
27
|
+
ActiveDecorator::Decorator.instance.decorate @object if @object
|
|
28
|
+
ActiveDecorator::Decorator.instance.decorate @collection unless @collection.blank?
|
|
18
29
|
|
|
19
|
-
|
|
30
|
+
self
|
|
31
|
+
end
|
|
20
32
|
end
|
|
21
33
|
end
|
|
22
34
|
end
|
|
@@ -6,6 +6,14 @@ module ActiveDecorator
|
|
|
6
6
|
ActiveSupport.on_load :action_view do
|
|
7
7
|
require 'active_decorator/monkey/action_view/partial_renderer'
|
|
8
8
|
ActionView::PartialRenderer.send :prepend, ActiveDecorator::Monkey::ActionView::PartialRenderer
|
|
9
|
+
|
|
10
|
+
if Rails.version.to_f >= 6.1
|
|
11
|
+
require 'active_decorator/monkey/action_view/collection_renderer'
|
|
12
|
+
ActionView::CollectionRenderer.send :prepend, ActiveDecorator::Monkey::ActionView::CollectionRenderer
|
|
13
|
+
|
|
14
|
+
require 'active_decorator/monkey/action_view/object_renderer'
|
|
15
|
+
ActionView::ObjectRenderer.send :prepend, ActiveDecorator::Monkey::ActionView::ObjectRenderer
|
|
16
|
+
end
|
|
9
17
|
end
|
|
10
18
|
|
|
11
19
|
ActiveSupport.on_load :action_controller do
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require '<%= File.
|
|
3
|
+
require '<%= File.exist?('spec/rails_helper.rb') ? 'rails_helper' : 'spec_helper' %>'
|
|
4
4
|
|
|
5
5
|
RSpec.describe <%= class_name %>Decorator do
|
|
6
6
|
let(:<%= singular_name %>) { <%= class_name %>.new.extend <%= class_name %>Decorator }
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: active_decorator
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.4.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Akira Matsuda
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2023-06-10 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|
|
@@ -108,20 +108,6 @@ dependencies:
|
|
|
108
108
|
- - ">="
|
|
109
109
|
- !ruby/object:Gem::Version
|
|
110
110
|
version: '0'
|
|
111
|
-
- !ruby/object:Gem::Dependency
|
|
112
|
-
name: jbuilder
|
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
|
114
|
-
requirements:
|
|
115
|
-
- - ">="
|
|
116
|
-
- !ruby/object:Gem::Version
|
|
117
|
-
version: '0'
|
|
118
|
-
type: :development
|
|
119
|
-
prerelease: false
|
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
121
|
-
requirements:
|
|
122
|
-
- - ">="
|
|
123
|
-
- !ruby/object:Gem::Version
|
|
124
|
-
version: '0'
|
|
125
111
|
- !ruby/object:Gem::Dependency
|
|
126
112
|
name: byebug
|
|
127
113
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -143,20 +129,15 @@ executables: []
|
|
|
143
129
|
extensions: []
|
|
144
130
|
extra_rdoc_files: []
|
|
145
131
|
files:
|
|
132
|
+
- ".github/dependabot.yml"
|
|
133
|
+
- ".github/workflows/main.yml"
|
|
146
134
|
- ".gitignore"
|
|
147
|
-
- ".travis.yml"
|
|
148
135
|
- CHANGELOG.md
|
|
149
136
|
- Gemfile
|
|
150
137
|
- MIT-LICENSE
|
|
151
138
|
- README.md
|
|
152
139
|
- Rakefile
|
|
153
140
|
- active_decorator.gemspec
|
|
154
|
-
- gemfiles/Gemfile-rails.4.2.x
|
|
155
|
-
- gemfiles/Gemfile-rails.5.0.x
|
|
156
|
-
- gemfiles/Gemfile-rails.5.1.x
|
|
157
|
-
- gemfiles/Gemfile-rails.5.2.x
|
|
158
|
-
- gemfiles/Gemfile-rails.6.0.x
|
|
159
|
-
- gemfiles/Gemfile-rails.edge
|
|
160
141
|
- lib/active_decorator.rb
|
|
161
142
|
- lib/active_decorator/config.rb
|
|
162
143
|
- lib/active_decorator/decorated.rb
|
|
@@ -164,6 +145,8 @@ files:
|
|
|
164
145
|
- lib/active_decorator/helpers.rb
|
|
165
146
|
- lib/active_decorator/monkey/abstract_controller/rendering.rb
|
|
166
147
|
- lib/active_decorator/monkey/action_controller/base/rescue_from.rb
|
|
148
|
+
- lib/active_decorator/monkey/action_view/collection_renderer.rb
|
|
149
|
+
- lib/active_decorator/monkey/action_view/object_renderer.rb
|
|
167
150
|
- lib/active_decorator/monkey/action_view/partial_renderer.rb
|
|
168
151
|
- lib/active_decorator/monkey/active_record/associations.rb
|
|
169
152
|
- lib/active_decorator/railtie.rb
|
|
@@ -176,41 +159,11 @@ files:
|
|
|
176
159
|
- lib/generators/rspec/templates/decorator_spec.rb
|
|
177
160
|
- lib/generators/test_unit/decorator_generator.rb
|
|
178
161
|
- lib/generators/test_unit/templates/decorator_test.rb
|
|
179
|
-
- test/configuration_test.rb
|
|
180
|
-
- test/controllers/fake_detection_test.rb
|
|
181
|
-
- test/decorator_test.rb
|
|
182
|
-
- test/fake_app/app/decorators/comic_decorator.rb
|
|
183
|
-
- test/fake_app/app/views/api/bookstores/show.json.jbuilder
|
|
184
|
-
- test/fake_app/app/views/authors/index.html.erb
|
|
185
|
-
- test/fake_app/app/views/authors/show.html.erb
|
|
186
|
-
- test/fake_app/app/views/authors/show.json.jbuilder
|
|
187
|
-
- test/fake_app/app/views/book_mailer/thanks.text.erb
|
|
188
|
-
- test/fake_app/app/views/books/_book.html.erb
|
|
189
|
-
- test/fake_app/app/views/books/_book.json.jbuilder
|
|
190
|
-
- test/fake_app/app/views/books/_book_locals.html.erb
|
|
191
|
-
- test/fake_app/app/views/books/errata.html.erb
|
|
192
|
-
- test/fake_app/app/views/books/errata2.html.erb
|
|
193
|
-
- test/fake_app/app/views/books/error.html.erb
|
|
194
|
-
- test/fake_app/app/views/books/index.html.erb
|
|
195
|
-
- test/fake_app/app/views/books/purchase.html.erb
|
|
196
|
-
- test/fake_app/app/views/books/show.html.erb
|
|
197
|
-
- test/fake_app/app/views/movies/show.html.erb
|
|
198
|
-
- test/fake_app/fake_app.rb
|
|
199
|
-
- test/fake_app/public/images/cover.png
|
|
200
|
-
- test/features/action_controller_api_test.rb
|
|
201
|
-
- test/features/action_view_helpers_test.rb
|
|
202
|
-
- test/features/association_test.rb
|
|
203
|
-
- test/features/controller_ivar_test.rb
|
|
204
|
-
- test/features/jbuilder_test.rb
|
|
205
|
-
- test/features/name_error_handling_test.rb
|
|
206
|
-
- test/features/partial_test.rb
|
|
207
|
-
- test/models/association_test.rb
|
|
208
|
-
- test/test_helper.rb
|
|
209
162
|
homepage: https://github.com/amatsuda/active_decorator
|
|
210
163
|
licenses:
|
|
211
164
|
- MIT
|
|
212
165
|
metadata: {}
|
|
213
|
-
post_install_message:
|
|
166
|
+
post_install_message:
|
|
214
167
|
rdoc_options: []
|
|
215
168
|
require_paths:
|
|
216
169
|
- lib
|
|
@@ -225,38 +178,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
225
178
|
- !ruby/object:Gem::Version
|
|
226
179
|
version: '0'
|
|
227
180
|
requirements: []
|
|
228
|
-
rubygems_version: 3.0.
|
|
229
|
-
signing_key:
|
|
181
|
+
rubygems_version: 3.5.0.dev
|
|
182
|
+
signing_key:
|
|
230
183
|
specification_version: 4
|
|
231
184
|
summary: A simple and Rubyish view helper for Rails
|
|
232
|
-
test_files:
|
|
233
|
-
- test/configuration_test.rb
|
|
234
|
-
- test/controllers/fake_detection_test.rb
|
|
235
|
-
- test/decorator_test.rb
|
|
236
|
-
- test/fake_app/app/decorators/comic_decorator.rb
|
|
237
|
-
- test/fake_app/app/views/api/bookstores/show.json.jbuilder
|
|
238
|
-
- test/fake_app/app/views/authors/index.html.erb
|
|
239
|
-
- test/fake_app/app/views/authors/show.html.erb
|
|
240
|
-
- test/fake_app/app/views/authors/show.json.jbuilder
|
|
241
|
-
- test/fake_app/app/views/book_mailer/thanks.text.erb
|
|
242
|
-
- test/fake_app/app/views/books/_book.html.erb
|
|
243
|
-
- test/fake_app/app/views/books/_book.json.jbuilder
|
|
244
|
-
- test/fake_app/app/views/books/_book_locals.html.erb
|
|
245
|
-
- test/fake_app/app/views/books/errata.html.erb
|
|
246
|
-
- test/fake_app/app/views/books/errata2.html.erb
|
|
247
|
-
- test/fake_app/app/views/books/error.html.erb
|
|
248
|
-
- test/fake_app/app/views/books/index.html.erb
|
|
249
|
-
- test/fake_app/app/views/books/purchase.html.erb
|
|
250
|
-
- test/fake_app/app/views/books/show.html.erb
|
|
251
|
-
- test/fake_app/app/views/movies/show.html.erb
|
|
252
|
-
- test/fake_app/fake_app.rb
|
|
253
|
-
- test/fake_app/public/images/cover.png
|
|
254
|
-
- test/features/action_controller_api_test.rb
|
|
255
|
-
- test/features/action_view_helpers_test.rb
|
|
256
|
-
- test/features/association_test.rb
|
|
257
|
-
- test/features/controller_ivar_test.rb
|
|
258
|
-
- test/features/jbuilder_test.rb
|
|
259
|
-
- test/features/name_error_handling_test.rb
|
|
260
|
-
- test/features/partial_test.rb
|
|
261
|
-
- test/models/association_test.rb
|
|
262
|
-
- test/test_helper.rb
|
|
185
|
+
test_files: []
|