garden_variety 1.1.0 → 1.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/README.md +17 -18
- data/lib/garden_variety/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: faba3e042115962ac309d1b92be5fb9db0949ee4
|
4
|
+
data.tar.gz: 9e14c2199d2a78bd25942f93ad5389260afef92c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c295e9ed45346e1fc217f6802b754e596addc462c4f4b04993de2905275269449364fd84eb45360844478fe7c24f44d65314809f86b6260dde2634801dc7ba0a
|
7
|
+
data.tar.gz: 2b69061392b472dace417c56ccab8bac6c9cf57be6c16a3ffd1cb6cc5e0534d713d5ce66b83ec7623ca6dfc06721241e2e99464c31448cd14236e4745570f816
|
data/README.md
CHANGED
@@ -221,17 +221,16 @@ end
|
|
221
221
|
### Integrating with authentication
|
222
222
|
|
223
223
|
The details of integrating authentication will depend on your chosen
|
224
|
-
authentication library. [Devise](https://rubygems.org/gems/devise) is
|
225
|
-
popular
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
following:
|
224
|
+
authentication library. [Devise](https://rubygems.org/gems/devise) is
|
225
|
+
the most popular, but [Clearance](https://rubygems.org/gems/clearance)
|
226
|
+
is also a strong choice. Whatever library you choose, it is likely to
|
227
|
+
include a "before filter" which you must invoke in your controller to
|
228
|
+
enforce authentication. Something similar to the following:
|
230
229
|
|
231
230
|
```ruby
|
232
231
|
class PostsController < ApplicationController
|
233
232
|
garden_variety
|
234
|
-
before_action :
|
233
|
+
before_action :authenticate_user!
|
235
234
|
end
|
236
235
|
```
|
237
236
|
|
@@ -248,11 +247,10 @@ defined to always return nil.
|
|
248
247
|
|
249
248
|
**Note about Clearance:** Clearance versions previous to 2.0 define a
|
250
249
|
deprecated `authorize` method which conflicts with Pundit. To avoid
|
251
|
-
this conflict, add the following line to your
|
252
|
-
Clearance initializer:
|
250
|
+
this conflict, add the following line to your Clearance initializer:
|
253
251
|
|
254
252
|
```ruby
|
255
|
-
::Clearance::
|
253
|
+
::Clearance::Authorization.send(:remove_method, :authorize)
|
256
254
|
```
|
257
255
|
|
258
256
|
|
@@ -305,9 +303,9 @@ conventional. The *garden_variety* helper methods all work as expected
|
|
305
303
|
because `RegistrationForm` responds to `assign_attributes` and `save`,
|
306
304
|
and has a default (nullary) constructor.
|
307
305
|
|
308
|
-
This pattern of overriding
|
309
|
-
success is common enough that *garden_variety* provides
|
310
|
-
for it:
|
306
|
+
This pattern of overriding a controller action merely to respond
|
307
|
+
differently upon success is common enough that *garden_variety* provides
|
308
|
+
a concise syntax for it:
|
311
309
|
|
312
310
|
```ruby
|
313
311
|
class RegistrationFormsController < ApplicationController
|
@@ -319,9 +317,9 @@ class RegistrationFormsController < ApplicationController
|
|
319
317
|
end
|
320
318
|
```
|
321
319
|
|
322
|
-
|
323
|
-
action, which is then invoked
|
324
|
-
|
320
|
+
In the above example, the `garden_variety` macro generates a
|
321
|
+
conventional `create` action, which is then invoked via `super` in the
|
322
|
+
`create` override. Here, when a block is passed to `super`, it is
|
325
323
|
treated as an on-success callback which replaces the default redirect.
|
326
324
|
This callback behavior is also available for the `update` and `destroy`
|
327
325
|
actions.
|
@@ -368,7 +366,8 @@ instance variable will be used instead of `@published_posts`.
|
|
368
366
|
|
369
367
|
This example may be somewhat contrived, but there is an excellent talk
|
370
368
|
from RailsConf which delves deeper into the principle:
|
371
|
-
[In Relentless Pursuit of REST](https://www.youtube.com/watch?v=HctYHe-YjnE)
|
369
|
+
[In Relentless Pursuit of REST](https://www.youtube.com/watch?v=HctYHe-YjnE)
|
370
|
+
([slides](https://speakerdeck.com/derekprior/in-relentless-pursuit-of-rest)).
|
372
371
|
|
373
372
|
|
374
373
|
## Installation
|
@@ -382,7 +381,7 @@ gem "garden_variety"
|
|
382
381
|
Then execute:
|
383
382
|
|
384
383
|
```bash
|
385
|
-
$ bundle
|
384
|
+
$ bundle install
|
386
385
|
```
|
387
386
|
|
388
387
|
And finally, if you haven't already used and installed Pundit, run the
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: garden_variety
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonathan Hefner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-05-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 5.
|
19
|
+
version: '5.2'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 5.
|
26
|
+
version: '5.2'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: pundit
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -103,7 +103,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
103
103
|
version: '0'
|
104
104
|
requirements: []
|
105
105
|
rubyforge_project:
|
106
|
-
rubygems_version: 2.
|
106
|
+
rubygems_version: 2.5.2.1
|
107
107
|
signing_key:
|
108
108
|
specification_version: 4
|
109
109
|
summary: Delightfully boring Rails controllers
|