responders 2.3.0 → 2.4.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a0c692c9db8d41efad52bc5dcbe523d7ffae971a
4
- data.tar.gz: ec9fab6aee728b24ac40a984c3d186a023a3d488
3
+ metadata.gz: 0d361bfe3389f2e44b47a078d164fd6cd90bfedb
4
+ data.tar.gz: 4c3c731cbd5d2bb82be8566b3ca2c9f81267be9c
5
5
  SHA512:
6
- metadata.gz: 7359a3b96df95cd3faba4c416f9fdb183fb75f6a7ec429e8377a13efd542e1f434c585d93e5cfe7f1ba4d16e1cdc3b617a6cd2ec7b5f99fd5f41cc6f8cd38229
7
- data.tar.gz: cdbd028d24c15b5225b06174dd8776b3200dc0d3c6ffada06b49c5a3341c9bc26d0bff1df27509187d94f763fd57a83b9dd4619bf46f69d65959d4937f022123
6
+ metadata.gz: 2105787536e9ea7484910379a1a0912eb0eaa4a7560289ac0f99d7d2f0779c5c7784d52ea69543d75b3a882c0b48d9ba7d6b7f51683c72db4367072489d76d09
7
+ data.tar.gz: 44b4014266a8573a5effb2aed8ce5a17c1642d8166411e88822df8a71825efe4f0a463315b22511191c38c02d8a4fb1bb465ef0c813f0c6db316d2196915dd0d
@@ -1,4 +1,10 @@
1
- ## Unreleased
1
+ ## 2.4.0
2
+
3
+ * `respond_with` now accepts a new kwargs called `:render` which goes straight to the `render`
4
+ call after an unsuccessful post request. Usefull if for example you need to render a template
5
+ which is outside of controller's path eg:
6
+
7
+ `respond_with resource, render: { template: 'path/to/template' }`
2
8
 
3
9
  ## 2.3.0
4
10
 
@@ -182,11 +182,17 @@ module ActionController #:nodoc:
182
182
  # to save a resource, e.g. when automatically rendering <tt>:new</tt>
183
183
  # after a post request.
184
184
  #
185
- # Two additional options are relevant specifically to +respond_with+ -
185
+ # Three additional options are relevant specifically to +respond_with+ -
186
186
  # 1. <tt>:location</tt> - overwrites the default redirect location used after
187
187
  # a successful html +post+ request.
188
188
  # 2. <tt>:action</tt> - overwrites the default render action used after an
189
189
  # unsuccessful html +post+ request.
190
+ # 3. <tt>:render</tt> - allows to pass any options directly to the <tt>:render<tt/>
191
+ # call after unsuccessful html +post+ request. Usefull if for example you
192
+ # need to render a template which is outside of controller's path or you
193
+ # want to override the default http <tt>:status</tt> code, e.g.
194
+ #
195
+ # response_with(resource, render: { template: 'path/to/template', status: 422 })
190
196
  def respond_with(*resources, &block)
191
197
  if self.class.mimes_for_respond_to.empty?
192
198
  raise "In order to use respond_with, first you need to declare the " \
@@ -200,7 +200,7 @@ module ActionController #:nodoc:
200
200
  if get?
201
201
  raise error
202
202
  elsif has_errors? && default_action
203
- render :action => default_action
203
+ render rendering_options
204
204
  else
205
205
  redirect_to navigation_location
206
206
  end
@@ -297,5 +297,13 @@ module ActionController #:nodoc:
297
297
  def response_overridden?
298
298
  @default_response.present?
299
299
  end
300
+
301
+ def rendering_options
302
+ if options[:render]
303
+ options[:render]
304
+ else
305
+ { action: default_action }
306
+ end
307
+ end
300
308
  end
301
309
  end
@@ -1,3 +1,3 @@
1
1
  module Responders
2
- VERSION = "2.3.0".freeze
2
+ VERSION = "2.4.0".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: responders
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.0
4
+ version: 2.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - José Valim
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-15 00:00:00.000000000 Z
11
+ date: 2017-04-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -19,7 +19,7 @@ dependencies:
19
19
  version: 4.2.0
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '5.1'
22
+ version: '5.3'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,7 +29,27 @@ dependencies:
29
29
  version: 4.2.0
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '5.1'
32
+ version: '5.3'
33
+ - !ruby/object:Gem::Dependency
34
+ name: actionpack
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: 4.2.0
40
+ - - "<"
41
+ - !ruby/object:Gem::Version
42
+ version: '5.3'
43
+ type: :runtime
44
+ prerelease: false
45
+ version_requirements: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: 4.2.0
50
+ - - "<"
51
+ - !ruby/object:Gem::Version
52
+ version: '5.3'
33
53
  description: A set of Rails responders to dry up your application
34
54
  email: contact@plataformatec.com.br
35
55
  executables: []
@@ -74,7 +94,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
74
94
  version: '0'
75
95
  requirements: []
76
96
  rubyforge_project: responders
77
- rubygems_version: 2.5.1
97
+ rubygems_version: 2.6.11
78
98
  signing_key:
79
99
  specification_version: 4
80
100
  summary: A set of Rails responders to dry up your application