responders 3.1.1 → 3.2.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/CHANGELOG.md +10 -0
- data/MIT-LICENSE +1 -1
- data/README.md +8 -4
- data/lib/action_controller/responder.rb +21 -9
- data/lib/responders/version.rb +1 -1
- metadata +65 -12
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 85caa4a2e0a2c40a2a902204e3770f87770e0e9897df78380e8f9f20c114599d
|
|
4
|
+
data.tar.gz: 4d5ef6e453e4a7931f03d460a3d47e017d040d1e6becc560136de6ca39ce82ff
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 44b1bd3400b1b1a8605966621bde0766e8b4b4ed5742f8cafd214304c60c0790988900ee30f881aed21884ca11d47258773404be3518049b6e34905822b5fad2
|
|
7
|
+
data.tar.gz: 5519dbfb23019487eda15ca485f38213aabd4abf8ec9e276c8a161e634429b9bb369a7989dee2f280b527c98f8020df8a5e779a2fa3270b367b5138ec23dcdfa
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
## Unreleased
|
|
2
|
+
|
|
3
|
+
* Support `allow_other_host` option in `respond_with`, forwarded to `redirect_to` (#255)
|
|
4
|
+
* Ruby 4.0 support (no changes required)
|
|
5
|
+
|
|
6
|
+
## 3.2.0
|
|
7
|
+
|
|
8
|
+
* Add support for Ruby 3.3/3.4 and Rails 7.2/8.0/8.1. (no changes required)
|
|
9
|
+
* Drop support for Rails < 7 and Ruby < 2.7.
|
|
10
|
+
|
|
1
11
|
## 3.1.1
|
|
2
12
|
|
|
3
13
|
* Add support for Rails 7.1. (no changes required.)
|
data/MIT-LICENSE
CHANGED
data/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Responders
|
|
2
2
|
|
|
3
|
-
[](https://badge.fury.io/rb/responders)
|
|
4
4
|
|
|
5
5
|
A set of responders modules to dry up your Rails app.
|
|
6
6
|
|
|
@@ -15,7 +15,7 @@ Update your bundle and run the install generator:
|
|
|
15
15
|
$ bundle install
|
|
16
16
|
$ rails g responders:install
|
|
17
17
|
|
|
18
|
-
If you are including this gem to support backwards
|
|
18
|
+
If you are including this gem to support backwards compatibility for responders in previous releases of Rails, you only need to include the gem and bundle.
|
|
19
19
|
|
|
20
20
|
$ bundle install
|
|
21
21
|
|
|
@@ -274,7 +274,7 @@ Want more examples ? Check out these blog posts:
|
|
|
274
274
|
|
|
275
275
|
* [Embracing REST with mind, body and soul](http://blog.plataformatec.com.br/2009/08/embracing-rest-with-mind-body-and-soul/)
|
|
276
276
|
* [Three reasons to love ActionController::Responder](http://weblog.rubyonrails.org/2009/8/31/three-reasons-love-responder/)
|
|
277
|
-
* [My five favorite things about Rails 3](
|
|
277
|
+
* [My five favorite things about Rails 3](https://web.archive.org/web/20201109041436/https://blog.engineyard.com/my-five-favorite-things-about-rails-3)
|
|
278
278
|
|
|
279
279
|
## Supported Ruby / Rails versions
|
|
280
280
|
|
|
@@ -287,4 +287,8 @@ and [Rails](https://guides.rubyonrails.org/maintenance_policy.html) maintenance
|
|
|
287
287
|
|
|
288
288
|
If you discover any bugs or want to drop a line, feel free to create an issue on GitHub.
|
|
289
289
|
|
|
290
|
-
|
|
290
|
+
## License
|
|
291
|
+
|
|
292
|
+
MIT License.
|
|
293
|
+
Copyright 2020-CURRENT Rafael França, Carlos Antonio da Silva.
|
|
294
|
+
Copyright 2009-2019 Plataformatec.
|
|
@@ -103,6 +103,11 @@ module ActionController # :nodoc:
|
|
|
103
103
|
#
|
|
104
104
|
# respond_with(@project, location: root_path)
|
|
105
105
|
#
|
|
106
|
+
# If the location is an external URL, pass <code>allow_other_host: true</code>
|
|
107
|
+
# to permit the redirect (this is forwarded to <code>redirect_to</code>):
|
|
108
|
+
#
|
|
109
|
+
# respond_with(@project, location: "https://example.com/", allow_other_host: true)
|
|
110
|
+
#
|
|
106
111
|
# To customize the failure scenario, you can pass a block to
|
|
107
112
|
# <code>respond_with</code>:
|
|
108
113
|
#
|
|
@@ -187,14 +192,14 @@ module ActionController # :nodoc:
|
|
|
187
192
|
# responds to :to_format and display it.
|
|
188
193
|
#
|
|
189
194
|
def to_format
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
195
|
+
begin
|
|
196
|
+
if !get? && has_errors? && !response_overridden?
|
|
197
|
+
return display_errors
|
|
198
|
+
elsif has_view_rendering? || response_overridden?
|
|
199
|
+
return default_render
|
|
200
|
+
end
|
|
201
|
+
rescue ActionView::MissingTemplate
|
|
196
202
|
end
|
|
197
|
-
rescue ActionView::MissingTemplate
|
|
198
203
|
api_behavior
|
|
199
204
|
end
|
|
200
205
|
|
|
@@ -207,7 +212,7 @@ module ActionController # :nodoc:
|
|
|
207
212
|
elsif has_errors? && default_action
|
|
208
213
|
render error_rendering_options
|
|
209
214
|
else
|
|
210
|
-
redirect_to navigation_location,
|
|
215
|
+
redirect_to navigation_location, redirect_options
|
|
211
216
|
end
|
|
212
217
|
end
|
|
213
218
|
|
|
@@ -281,7 +286,8 @@ module ActionController # :nodoc:
|
|
|
281
286
|
|
|
282
287
|
# Check whether the necessary Renderer is available
|
|
283
288
|
def has_renderer?
|
|
284
|
-
Renderers
|
|
289
|
+
renderers = Renderers.respond_to?(:all) ? Renderers.all : Renderers::RENDERERS
|
|
290
|
+
renderers.include?(format)
|
|
285
291
|
end
|
|
286
292
|
|
|
287
293
|
def has_view_rendering?
|
|
@@ -314,5 +320,11 @@ module ActionController # :nodoc:
|
|
|
314
320
|
{ action: default_action, status: error_status }
|
|
315
321
|
end
|
|
316
322
|
end
|
|
323
|
+
|
|
324
|
+
def redirect_options
|
|
325
|
+
redirect_options = { status: redirect_status }
|
|
326
|
+
redirect_options[:allow_other_host] = options[:allow_other_host] if options.key?(:allow_other_host)
|
|
327
|
+
redirect_options
|
|
328
|
+
end
|
|
317
329
|
end
|
|
318
330
|
end
|
data/lib/responders/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: responders
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.
|
|
4
|
+
version: 3.2.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- José Valim
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: railties
|
|
@@ -16,30 +15,86 @@ dependencies:
|
|
|
16
15
|
requirements:
|
|
17
16
|
- - ">="
|
|
18
17
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: '
|
|
18
|
+
version: '7.0'
|
|
20
19
|
type: :runtime
|
|
21
20
|
prerelease: false
|
|
22
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
22
|
requirements:
|
|
24
23
|
- - ">="
|
|
25
24
|
- !ruby/object:Gem::Version
|
|
26
|
-
version: '
|
|
25
|
+
version: '7.0'
|
|
27
26
|
- !ruby/object:Gem::Dependency
|
|
28
27
|
name: actionpack
|
|
29
28
|
requirement: !ruby/object:Gem::Requirement
|
|
30
29
|
requirements:
|
|
31
30
|
- - ">="
|
|
32
31
|
- !ruby/object:Gem::Version
|
|
33
|
-
version: '
|
|
32
|
+
version: '7.0'
|
|
34
33
|
type: :runtime
|
|
35
34
|
prerelease: false
|
|
36
35
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
36
|
requirements:
|
|
38
37
|
- - ">="
|
|
39
38
|
- !ruby/object:Gem::Version
|
|
40
|
-
version: '
|
|
39
|
+
version: '7.0'
|
|
40
|
+
- !ruby/object:Gem::Dependency
|
|
41
|
+
name: rails-controller-testing
|
|
42
|
+
requirement: !ruby/object:Gem::Requirement
|
|
43
|
+
requirements:
|
|
44
|
+
- - ">="
|
|
45
|
+
- !ruby/object:Gem::Version
|
|
46
|
+
version: '0'
|
|
47
|
+
type: :development
|
|
48
|
+
prerelease: false
|
|
49
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
50
|
+
requirements:
|
|
51
|
+
- - ">="
|
|
52
|
+
- !ruby/object:Gem::Version
|
|
53
|
+
version: '0'
|
|
54
|
+
- !ruby/object:Gem::Dependency
|
|
55
|
+
name: mocha
|
|
56
|
+
requirement: !ruby/object:Gem::Requirement
|
|
57
|
+
requirements:
|
|
58
|
+
- - ">="
|
|
59
|
+
- !ruby/object:Gem::Version
|
|
60
|
+
version: '0'
|
|
61
|
+
type: :development
|
|
62
|
+
prerelease: false
|
|
63
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
64
|
+
requirements:
|
|
65
|
+
- - ">="
|
|
66
|
+
- !ruby/object:Gem::Version
|
|
67
|
+
version: '0'
|
|
68
|
+
- !ruby/object:Gem::Dependency
|
|
69
|
+
name: rake
|
|
70
|
+
requirement: !ruby/object:Gem::Requirement
|
|
71
|
+
requirements:
|
|
72
|
+
- - ">="
|
|
73
|
+
- !ruby/object:Gem::Version
|
|
74
|
+
version: '0'
|
|
75
|
+
type: :development
|
|
76
|
+
prerelease: false
|
|
77
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
78
|
+
requirements:
|
|
79
|
+
- - ">="
|
|
80
|
+
- !ruby/object:Gem::Version
|
|
81
|
+
version: '0'
|
|
82
|
+
- !ruby/object:Gem::Dependency
|
|
83
|
+
name: rdoc
|
|
84
|
+
requirement: !ruby/object:Gem::Requirement
|
|
85
|
+
requirements:
|
|
86
|
+
- - ">="
|
|
87
|
+
- !ruby/object:Gem::Version
|
|
88
|
+
version: '0'
|
|
89
|
+
type: :development
|
|
90
|
+
prerelease: false
|
|
91
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
92
|
+
requirements:
|
|
93
|
+
- - ">="
|
|
94
|
+
- !ruby/object:Gem::Version
|
|
95
|
+
version: '0'
|
|
41
96
|
description: A set of Rails responders to dry up your application
|
|
42
|
-
email: heartcombo@
|
|
97
|
+
email: heartcombo.oss@gmail.com
|
|
43
98
|
executables: []
|
|
44
99
|
extensions: []
|
|
45
100
|
extra_rdoc_files: []
|
|
@@ -69,7 +124,6 @@ metadata:
|
|
|
69
124
|
changelog_uri: https://github.com/heartcombo/responders/blob/main/CHANGELOG.md
|
|
70
125
|
source_code_uri: https://github.com/heartcombo/responders
|
|
71
126
|
bug_tracker_uri: https://github.com/heartcombo/responders/issues
|
|
72
|
-
post_install_message:
|
|
73
127
|
rdoc_options: []
|
|
74
128
|
require_paths:
|
|
75
129
|
- lib
|
|
@@ -77,15 +131,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
77
131
|
requirements:
|
|
78
132
|
- - ">="
|
|
79
133
|
- !ruby/object:Gem::Version
|
|
80
|
-
version: 2.
|
|
134
|
+
version: 2.7.0
|
|
81
135
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
82
136
|
requirements:
|
|
83
137
|
- - ">="
|
|
84
138
|
- !ruby/object:Gem::Version
|
|
85
139
|
version: '0'
|
|
86
140
|
requirements: []
|
|
87
|
-
rubygems_version:
|
|
88
|
-
signing_key:
|
|
141
|
+
rubygems_version: 4.0.16
|
|
89
142
|
specification_version: 4
|
|
90
143
|
summary: A set of Rails responders to dry up your application
|
|
91
144
|
test_files: []
|