patch-patch 0.0.2 → 0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 73a2adf47e7e17fb68da032b16997b7153f5fd27
4
- data.tar.gz: 1bad23bfe88e71e844406b8a4978d3e80ba26c82
3
+ metadata.gz: 3e06fb21b3a5b5b8991e74ad7bcdd4ca7eb77865
4
+ data.tar.gz: 7cbaeeab287bd12430f542a6aab8cc1777e64fdc
5
5
  SHA512:
6
- metadata.gz: d92eb149e8ead8a2fe576474e4d695215ea3ca49f94eb968e7115e82db1bdc26f8c80a0745778e3f70af3c8c90a2defe3ccbf95b17aee90fa27bd41fcec5504e
7
- data.tar.gz: f58619c9d21a91d8419fb807d23d939d9083614553af82acf9b2473c83f98499f071f058d1c7ee5781f5af9ff3a6458447c3c6a53efb0d5452e7d157654ab258
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
- Or install it yourself as:
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
- $ gem install patch-patch
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.
@@ -1,3 +1,3 @@
1
1
  module PatchPatch
2
- VERSION = '0.0.2'
2
+ VERSION = '0.1'
3
3
  end
@@ -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', '>= 3.0.0'
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.0.2
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: 3.0.0
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: 3.0.0
26
+ version: 4.0.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement