responders 2.1.0 → 2.1.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 +4 -0
- data/MIT-LICENSE +1 -1
- data/README.md +26 -6
- data/lib/action_controller/respond_with.rb +2 -0
- data/lib/action_controller/responder.rb +1 -1
- data/lib/responders/controller_method.rb +3 -1
- data/lib/responders/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 921e032d21bf201f9199b401ecdca88cbbc9668f
|
4
|
+
data.tar.gz: e2f710246648471f2f62fa37305c972497a2320a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7a1de1eab1ecd945eed1c5ea80c14bb9570902c00a2f19f9de2404bd267a5cc6ffad885c737594ec6ed559df473ae5e64ce293a9ed986a724cac458ba54ac56f
|
7
|
+
data.tar.gz: d02ec53cc1cb3b7001e03effb6167fdfb57b8823a8dbbf3d04eeaa029f94249e98dde1cb7154db9c451585a3c524b9ec6b680f4e56a9695ba87862fc7a74b5e0
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
## 2.1.1
|
2
|
+
|
3
|
+
* Added support for Rails 5.
|
4
|
+
|
1
5
|
## 2.1.0
|
2
6
|
|
3
7
|
* No longer automatically set the responders generator as many projects may use this gem as a dependency. When upgrading, users will need to add `config.app_generators.scaffold_controller :responders_controller` to their application. The `responders:install` generator has been updated to automatically insert it in new applications
|
data/MIT-LICENSE
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Copyright 2009-
|
1
|
+
Copyright 2009-2015 Plataformatec. http://plataformatec.com.br
|
2
2
|
|
3
3
|
Permission is hereby granted, free of charge, to any person obtaining
|
4
4
|
a copy of this software and associated documentation files (the
|
data/README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# Responders
|
2
2
|
|
3
|
-
[](http://badge.fury.io/rb/responders)
|
4
|
+
[](http://travis-ci.org/plataformatec/responders)
|
5
|
+
[](https://codeclimate.com/github/plataformatec/responders)
|
6
6
|
|
7
7
|
A set of responders modules to dry up your Rails 4.2+ app.
|
8
8
|
|
@@ -17,6 +17,10 @@ Update your bundle and run the install generator:
|
|
17
17
|
$ bundle install
|
18
18
|
$ rails g responders:install
|
19
19
|
|
20
|
+
If you are including this gem to support backwards compatibilty for responders in previous releases of Rails, you only need to include the gem and bundle.
|
21
|
+
|
22
|
+
$ bundle install
|
23
|
+
|
20
24
|
## Responders Types
|
21
25
|
|
22
26
|
### FlashResponder
|
@@ -101,6 +105,22 @@ class ThingsController < ApplicationController
|
|
101
105
|
end
|
102
106
|
```
|
103
107
|
|
108
|
+
**Dealing with namespaced routes**
|
109
|
+
|
110
|
+
In order for the LocationResponder to find the correct route helper for namespaced routes you need to pass the namespaces to `respond_with`:
|
111
|
+
|
112
|
+
```ruby
|
113
|
+
class Api::V1::ThingsController < ApplicationController
|
114
|
+
respond_to :json
|
115
|
+
|
116
|
+
# POST /api/v1/things
|
117
|
+
def create
|
118
|
+
@thing = Thing.create(thing_params)
|
119
|
+
respond_with :api, :v1, @thing
|
120
|
+
end
|
121
|
+
end
|
122
|
+
```
|
123
|
+
|
104
124
|
## Configuring your own responder
|
105
125
|
|
106
126
|
Responders only provides a set of modules and to use them you have to create your own
|
@@ -109,7 +129,7 @@ generated in your application:
|
|
109
129
|
|
110
130
|
```ruby
|
111
131
|
# lib/application_responder.rb
|
112
|
-
class
|
132
|
+
class ApplicationResponder < ActionController::Responder
|
113
133
|
include Responders::FlashResponder
|
114
134
|
include Responders::HttpCacheResponder
|
115
135
|
end
|
@@ -122,7 +142,7 @@ Your application also needs to be configured to use it:
|
|
122
142
|
require "application_responder"
|
123
143
|
|
124
144
|
class ApplicationController < ActionController::Base
|
125
|
-
self.responder =
|
145
|
+
self.responder = ApplicationResponder
|
126
146
|
respond_to :html
|
127
147
|
end
|
128
148
|
```
|
@@ -182,4 +202,4 @@ If you discover any bugs or want to drop a line, feel free to create an issue on
|
|
182
202
|
|
183
203
|
http://github.com/plataformatec/responders/issues
|
184
204
|
|
185
|
-
MIT License. Copyright 2009-
|
205
|
+
MIT License. Copyright 2009-2015 Plataformatec. http://plataformatec.com.br
|
@@ -175,7 +175,9 @@ module ActionController #:nodoc:
|
|
175
175
|
# Also, a hash passed to +respond_with+ immediately after the specified
|
176
176
|
# resource(s) is interpreted as a set of options relevant to all
|
177
177
|
# formats. Any option accepted by +render+ can be used, e.g.
|
178
|
+
#
|
178
179
|
# respond_with @people, status: 200
|
180
|
+
#
|
179
181
|
# However, note that these options are ignored after an unsuccessful attempt
|
180
182
|
# to save a resource, e.g. when automatically rendering <tt>:new</tt>
|
181
183
|
# after a post request.
|
data/lib/responders/version.rb
CHANGED
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.1.
|
4
|
+
version: 2.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- José Valim
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-12-19 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'
|
22
|
+
version: '5.1'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -29,7 +29,7 @@ dependencies:
|
|
29
29
|
version: 4.2.0
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '5'
|
32
|
+
version: '5.1'
|
33
33
|
description: A set of Rails responders to dry up your application
|
34
34
|
email: contact@plataformatec.com.br
|
35
35
|
executables: []
|
@@ -73,7 +73,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
73
73
|
version: '0'
|
74
74
|
requirements: []
|
75
75
|
rubyforge_project: responders
|
76
|
-
rubygems_version: 2.
|
76
|
+
rubygems_version: 2.4.5
|
77
77
|
signing_key:
|
78
78
|
specification_version: 4
|
79
79
|
summary: A set of Rails responders to dry up your application
|