patch-patch 0.0.2 → 0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +43 -3
- data/lib/patch_patch/version.rb +1 -1
- data/patch-patch.gemspec +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3e06fb21b3a5b5b8991e74ad7bcdd4ca7eb77865
|
4
|
+
data.tar.gz: 7cbaeeab287bd12430f542a6aab8cc1777e64fdc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ab431b5c09a196d9006eae299f8161b816b1b96ab2fa191dd3996d2101c24ca88ea649a2fd0cf881184d28595fd3a27fbc885da9cd07b70bd07328c498799a90
|
7
|
+
data.tar.gz: adb4cdf7f1ae4bf5fe20fb6b0781f3282e2b1ae5bdb521fe3c9d67c782a1f8266038d0ccfbb334c9fd493bb6d7266e4d00aa3aaa2e47feed69d6a09b17a9136e
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# PatchPatch
|
2
2
|
|
3
|
-
PatchPatch changes Rails’ default behavior of mapping PUT and PATCH requests on resources to the same action.
|
3
|
+
PatchPatch changes Rails’ default behavior of mapping `PUT` and `PATCH` requests on resources to the same action.
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -16,12 +16,52 @@ And then execute:
|
|
16
16
|
$ bundle
|
17
17
|
```
|
18
18
|
|
19
|
-
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
PatchPatch hooks itself automatically into Rails’ routing engine. You don’t have to enable or configure it.
|
22
|
+
|
23
|
+
Let’s say we have a RESTful API with a single `users` resource.
|
24
|
+
|
25
|
+
```ruby
|
26
|
+
# config/routes.rb
|
27
|
+
Foo::Application.routes.draw do
|
28
|
+
resources :users
|
29
|
+
end
|
30
|
+
```
|
31
|
+
|
32
|
+
### Before
|
20
33
|
|
21
34
|
```bash
|
22
|
-
$
|
35
|
+
$ rake routes
|
36
|
+
Prefix Verb URI Pattern Controller#Action
|
37
|
+
users GET /users(.:format) users#index
|
38
|
+
POST /users(.:format) users#create
|
39
|
+
new_user GET /users/new(.:format) users#new
|
40
|
+
edit_user GET /users/:id/edit(.:format) users#edit
|
41
|
+
user GET /users/:id(.:format) users#show
|
42
|
+
PATCH /users/:id(.:format) users#update
|
43
|
+
PUT /users/:id(.:format) users#update
|
44
|
+
DELETE /users/:id(.:format) users#destroy
|
23
45
|
```
|
24
46
|
|
47
|
+
### After
|
48
|
+
|
49
|
+
```bash
|
50
|
+
$ rake routes
|
51
|
+
Prefix Verb URI Pattern Controller#Action
|
52
|
+
users GET /users(.:format) users#index
|
53
|
+
POST /users(.:format) users#create
|
54
|
+
new_user GET /users/new(.:format) users#new
|
55
|
+
edit_user GET /users/:id/edit(.:format) users#edit
|
56
|
+
user PATCH /users/:id(.:format) users#partial_update
|
57
|
+
GET /users/:id(.:format) users#show
|
58
|
+
PATCH /users/:id(.:format) users#update
|
59
|
+
PUT /users/:id(.:format) users#update
|
60
|
+
DELETE /users/:id(.:format) users#destroy
|
61
|
+
```
|
62
|
+
|
63
|
+
_Note: the old `PATCH` route is still there but it will never be matched since our `#partial_update` route comes first. The old `PUT` route will still route to `#update` though._
|
64
|
+
|
25
65
|
## License
|
26
66
|
|
27
67
|
`PatchPatch` is © 2013 [Mirego](http://www.mirego.com) and may be freely distributed under the [New BSD license](http://opensource.org/licenses/BSD-3-Clause). See the [`LICENSE.md`](https://github.com/mirego/patch-patch/blob/master/LICENSE.md) file.
|
data/lib/patch_patch/version.rb
CHANGED
data/patch-patch.gemspec
CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ['lib']
|
20
20
|
|
21
|
-
spec.add_dependency 'actionpack', '>=
|
21
|
+
spec.add_dependency 'actionpack', '>= 4.0.0'
|
22
22
|
|
23
23
|
spec.add_development_dependency 'bundler'
|
24
24
|
spec.add_development_dependency 'rake'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: patch-patch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: '0.1'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rémi Prévost
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '>='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 4.0.0
|
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:
|
26
|
+
version: 4.0.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|