inherited_resources 1.13.1 → 2.1.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
  SHA256:
3
- metadata.gz: e985edc0b00007f056c8bab4bf65f18cb9ac7b087478390e12362b7a45868130
4
- data.tar.gz: 28d9210771402b65da33424ad31aec491b97db10764a58400e8b2c77206f2d61
3
+ metadata.gz: aaebb8b497c48f9057e36c1dcf828487b28fec89e6b71c586b358e402fd34984
4
+ data.tar.gz: 5e52d03746f0c38b5dc1babb70e52e8f0c563613e67fa6ce1169e0ec130472e7
5
5
  SHA512:
6
- metadata.gz: 46791f6fbb49ffe7c997a794c58f46ede3473b26e6d1d9631e3cc541091fbfa070eef3610e32790e7e1dbff4b38148b243bf477514dfbfa88eaa407765cafd34
7
- data.tar.gz: 6ca9898f4c265ed6115116e2a6aa94358e497fea6320da6018c7dec01cb9731e29969ad27fcf58c981ad7ec95f6abf22a9e04ec5071d16001aba7e3f0b38ecd6
6
+ metadata.gz: fcdda43c097f8a9e75d5711ca5268b6b4b01c0462bd46084b30e48d880fdd2334399885f54dc966f6ecbac38390c25805c5f31333e467c892be2ae3a10afc9a0
7
+ data.tar.gz: ec4aede5a01a46cc309e2254d2817d4d9e5a134f15dec60590c1473ce723c5a170152188e89048ace1aae0c2d2cf54b81cdb25628b1b6ac1dcbf47dccef49276
data/README.md CHANGED
@@ -5,7 +5,7 @@ has been transferred to the ActiveAdmin organization for maintenance. New featu
5
5
  requests are not encouraged.
6
6
 
7
7
  If you are not already using Inherited Resources we suggest instead using Rails'
8
- `respond_with` feature alongside the [responders gem](https://github.com/plataformatec/responders).
8
+ `respond_with` feature alongside the [responders gem](https://github.com/heartcombo/responders).
9
9
 
10
10
  ## Inherited Resources
11
11
 
@@ -22,7 +22,7 @@ code by following fat models and skinny controllers convention. There are
22
22
  two screencasts available besides this README:
23
23
 
24
24
  * http://railscasts.com/episodes/230-inherited-resources
25
- * http://akitaonrails.com/2009/09/01/screencast-real-thin-restful-controllers-with-inherited-resources
25
+ * https://www.akitaonrails.com/2009/09/01/screencast-real-thin-restful-controllers-with-inherited-resources
26
26
 
27
27
  ## Installation
28
28
 
@@ -49,7 +49,7 @@ $ gem install inherited_resources
49
49
  Since Inherited Resources 1.0, has_scope is not part of its core anymore but
50
50
  a gem dependency. Be sure to check the documentation to see how you can use it:
51
51
 
52
- - <http://github.com/plataformatec/has_scope>
52
+ - <https://github.com/heartcombo/has_scope>
53
53
 
54
54
  And it can be installed as:
55
55
 
@@ -64,7 +64,7 @@ but is set as Inherited Resources dependency and it's used by default by
64
64
  InheritedResources controllers. Be sure to check the documentation to see
65
65
  how it will change your application:
66
66
 
67
- - <http://github.com/plataformatec/responders>
67
+ - <https://github.com/heartcombo/responders>
68
68
 
69
69
  And it can be installed with:
70
70
 
@@ -168,6 +168,13 @@ class AccountsController < ApplicationController
168
168
  end
169
169
  ```
170
170
 
171
+ By default, `InheritedResources::Base` will inherit from `::ApplicationController`. You can change this in a rails initializer:
172
+
173
+ ```ruby
174
+ # config/initializers/inherited_resources.rb
175
+ InheritedResources.parent_controller = 'MyController'
176
+ ```
177
+
171
178
  ## Overwriting defaults
172
179
 
173
180
  Whenever you inherit from InheritedResources, several defaults are assumed.
@@ -737,11 +744,11 @@ MIT License. Copyright (c) 2009-2017 José Valim.
737
744
  Please use the Tidelift security contact to [report a security vulnerability][Tidelift security contact].
738
745
  Tidelift will coordinate the fix and disclosure.
739
746
 
740
- [rubygems_badge]: http://img.shields.io/gem/v/inherited_resources.svg
747
+ [rubygems_badge]: https://img.shields.io/gem/v/inherited_resources.svg
741
748
  [rubygems]: https://rubygems.org/gems/inherited_resources
742
749
  [actions_badge]: https://github.com/activeadmin/inherited_resources/workflows/ci/badge.svg
743
750
  [actions]: https://github.com/activeadmin/inherited_resources/actions
744
- [tidelift_badge]: https://tidelift.com/badges/github/activeadmin/inherited_resources
751
+ [tidelift_badge]: https://tidelift.com/badges/package/rubygems/inherited_resources?style=flat
745
752
  [tidelift]: https://tidelift.com/subscription/pkg/rubygems-inherited-resources?utm_source=rubygems-inherited-resources&utm_medium=referral&utm_campaign=readme
746
753
 
747
754
  [Tidelift security contact]: https://tidelift.com/security
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module InheritedResources
2
3
  # = Base
3
4
  #
@@ -8,7 +9,7 @@ module InheritedResources
8
9
  # call <tt>default</tt> class method, call <<tt>actions</tt> class method
9
10
  # or overwrite some helpers in the base_helpers.rb file.
10
11
  #
11
- class Base < ::ApplicationController
12
+ class Base < InheritedResources.parent_controller.constantize
12
13
  # Overwrite inherit_resources to add specific InheritedResources behavior.
13
14
  def self.inherit_resources(base)
14
15
  base.class_eval do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rails/generators/rails/scaffold_controller/scaffold_controller_generator'
2
4
 
3
5
  module Rails
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module InheritedResources
2
- # Holds all default actions for InheritedResouces.
4
+ # Holds all default actions for InheritedResources.
3
5
  module Actions
4
6
 
5
7
  # GET /resources
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Whenever base is required load the dumb responder since it's used inside actions.
2
- require 'inherited_resources/blank_slate'
4
+ require_relative 'blank_slate'
3
5
 
4
6
  module InheritedResources
5
7
  # Base helpers for InheritedResource work. Some methods here can be overwritten
@@ -54,7 +56,7 @@ module InheritedResources
54
56
 
55
57
  # Responsible for saving the resource on :create method. Overwriting this
56
58
  # allow you to control the way resource is saved. Let's say you have a
57
- # PassworsController who is responsible for finding an user by email and
59
+ # PasswordsController who is responsible for finding an user by email and
58
60
  # sent password instructions for him. Instead of overwriting the entire
59
61
  # :create method, you could do something:
60
62
  #
@@ -133,7 +135,7 @@ module InheritedResources
133
135
  end
134
136
 
135
137
  # rubocop:disable Layout/CommentIndentation
136
- # See https://github.com/rubocop-hq/rubocop/issues/6450
138
+ # See https://github.com/rubocop/rubocop/issues/6450
137
139
  #
138
140
  # Overwrite this method to provide other interpolation options when
139
141
  # the flash message is going to be set.
@@ -215,7 +217,7 @@ module InheritedResources
215
217
  #
216
218
  def get_resource_ivar #:nodoc:
217
219
  if instance_variable_defined?(:"@#{resource_instance_name}")
218
- instance_variable_get("@#{resource_instance_name}")
220
+ instance_variable_get(:"@#{resource_instance_name}")
219
221
  else
220
222
  nil
221
223
  end
@@ -224,14 +226,14 @@ module InheritedResources
224
226
  # Set resource ivar based on the current resource controller.
225
227
  #
226
228
  def set_resource_ivar(resource) #:nodoc:
227
- instance_variable_set("@#{resource_instance_name}", resource)
229
+ instance_variable_set(:"@#{resource_instance_name}", resource)
228
230
  end
229
231
 
230
232
  # Get collection ivar based on the current resource controller.
231
233
  #
232
234
  def get_collection_ivar #:nodoc:
233
235
  if instance_variable_defined?(:"@#{resource_collection_name}")
234
- instance_variable_get("@#{resource_collection_name}")
236
+ instance_variable_get(:"@#{resource_collection_name}")
235
237
  else
236
238
  nil
237
239
  end
@@ -240,7 +242,7 @@ module InheritedResources
240
242
  # Set collection ivar based on the current resource controller.
241
243
  #
242
244
  def set_collection_ivar(collection) #:nodoc:
243
- instance_variable_set("@#{resource_collection_name}", collection)
245
+ instance_variable_set(:"@#{resource_collection_name}", collection)
244
246
  end
245
247
 
246
248
  # Used to allow to specify success and failure within just one block:
@@ -368,7 +370,7 @@ module InheritedResources
368
370
  self.resources_configuration[:self][:role].present?
369
371
  end
370
372
 
371
- # getting role for mass-asignment
373
+ # getting role for mass-assignment
372
374
  def as_role
373
375
  { as: self.resources_configuration[:self][:role] }
374
376
  end
@@ -1,9 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module InheritedResources
2
4
 
3
5
  # = belongs_to
4
6
  #
5
7
  # Let's suppose that we have some tasks that belongs to projects. To specify
6
- # this assoication in your controllers, just do:
8
+ # this association in your controllers, just do:
7
9
  #
8
10
  # class TasksController < InheritedResources::Base
9
11
  # belongs_to :project
@@ -77,7 +79,7 @@ module InheritedResources
77
79
 
78
80
  def get_parent_ivar(instance_name) #:nodoc:
79
81
  instance_variable_defined?(:"@#{instance_name}") &&
80
- instance_variable_get("@#{instance_name}")
82
+ instance_variable_get(:"@#{instance_name}")
81
83
  end
82
84
 
83
85
  def set_parent_instance(parent_config, chain) #:nodoc:
@@ -97,7 +99,7 @@ module InheritedResources
97
99
  parent = parent.send(parent_config[:finder], params[parent_config[:param]])
98
100
  end
99
101
 
100
- instance_variable_set("@#{parent_config[:instance_name]}", parent)
102
+ instance_variable_set(:"@#{parent_config[:instance_name]}", parent)
101
103
  end
102
104
 
103
105
  # Maps parents_symbols to build association chain. In this case, it
@@ -1,8 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module InheritedResources
2
4
  # An object from BlankSlate simply discards all messages sent to it.
3
5
  class BlankSlate
4
6
  instance_methods.each do |m|
5
- undef_method m unless m =~ /^(__|object_id)/
7
+ undef_method m unless /^(__|object_id)/.match?(m)
6
8
  end
7
9
 
8
10
  def method_missing(*args)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module InheritedResources
2
4
  module ClassMethods
3
5
 
@@ -25,7 +27,7 @@ module InheritedResources
25
27
  #
26
28
  # * <tt>:route_instance_name</tt> - The name of the singular route. Defaults to :instance_name.
27
29
  #
28
- # * <tt>:route_prefix</tt> - The route prefix which is automically set in namespaced
30
+ # * <tt>:route_prefix</tt> - The route prefix which is automatically set in namespaced
29
31
  # controllers. Default to :admin on Admin::ProjectsController.
30
32
  #
31
33
  # * <tt>:singleton</tt> - Tells if this controller is singleton or not.
@@ -53,7 +55,7 @@ module InheritedResources
53
55
  config[:request_name] = begin
54
56
  request_name = self.resource_class
55
57
  request_name = request_name.model_name.param_key if request_name.respond_to?(:model_name)
56
- request_name.to_s.underscore.gsub('/', '_')
58
+ request_name.to_s.underscore.tr('/', '_')
57
59
  end
58
60
  options.delete(:resource_class) and options.delete(:class_name)
59
61
  end
@@ -65,7 +67,7 @@ module InheritedResources
65
67
  create_resources_url_helpers!
66
68
  end
67
69
 
68
- # Defines wich actions will be inherited from the inherited controller.
70
+ # Defines which actions will be inherited from the inherited controller.
69
71
  # Syntax is borrowed from resource_controller.
70
72
  #
71
73
  # actions :index, :show, :edit
@@ -215,7 +217,7 @@ module InheritedResources
215
217
  config[:finder] = finder || :find
216
218
  end
217
219
 
218
- if block_given?
220
+ if block
219
221
  class_eval(&block)
220
222
  else
221
223
  create_resources_url_helpers!
@@ -227,7 +229,7 @@ module InheritedResources
227
229
  #
228
230
  def polymorphic_belongs_to(*symbols, &block)
229
231
  options = symbols.extract_options!
230
- options.merge!(polymorphic: true)
232
+ options[:polymorphic] = true
231
233
  belongs_to(*symbols, options, &block)
232
234
  end
233
235
 
@@ -235,7 +237,7 @@ module InheritedResources
235
237
  #
236
238
  def singleton_belongs_to(*symbols, &block)
237
239
  options = symbols.extract_options!
238
- options.merge!(singleton: true)
240
+ options[:singleton] = true
239
241
  belongs_to(*symbols, options, &block)
240
242
  end
241
243
 
@@ -243,7 +245,7 @@ module InheritedResources
243
245
  #
244
246
  def optional_belongs_to(*symbols, &block)
245
247
  options = symbols.extract_options!
246
- options.merge!(optional: true)
248
+ options[:optional] = true
247
249
  belongs_to(*symbols, options, &block)
248
250
  end
249
251
 
@@ -384,7 +386,7 @@ module InheritedResources
384
386
  # Forum::Thread#create will properly pick up the request parameter
385
387
  # which will be forum_thread, and not thread
386
388
  # Additionally make this work orthogonally with instance_name
387
- config[:request_name] = self.resource_class.to_s.underscore.gsub('/', '_')
389
+ config[:request_name] = self.resource_class.to_s.underscore.tr('/', '_')
388
390
 
389
391
  # Initialize polymorphic, singleton, scopes and belongs_to parameters
390
392
  polymorphic = self.resources_configuration[:polymorphic] || { symbols: [], optional: false }
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module InheritedResources
2
4
  # Allows controllers to write actions using a class method DSL.
3
5
  #
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module InheritedResources
2
4
  class Railtie < ::Rails::Engine
3
5
  config.inherited_resources = InheritedResources
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module InheritedResources
2
4
 
3
5
  # = polymorphic associations
@@ -120,8 +122,8 @@ module InheritedResources
120
122
  #
121
123
  def parent
122
124
  if parent_type
123
- p = instance_variable_defined?("@#{parent_type}") && instance_variable_get("@#{parent_type}")
124
- p || instance_variable_set("@#{parent_type}", association_chain[-1])
125
+ p = instance_variable_defined?(:"@#{parent_type}") && instance_variable_get(:"@#{parent_type}")
126
+ p || instance_variable_set(:"@#{parent_type}", association_chain[-1])
125
127
  end
126
128
  end
127
129
 
@@ -151,9 +153,9 @@ module InheritedResources
151
153
  if symbol == :polymorphic
152
154
  params_keys = params.keys
153
155
 
154
- keys = polymorphic_config[:symbols].map do |poly|
155
- params_keys.include?(resources_configuration[poly][:param].to_s) ? poly : nil
156
- end.compact
156
+ keys = polymorphic_config[:symbols].select do |poly|
157
+ params_keys.include?(resources_configuration[poly][:param].to_s)
158
+ end
157
159
 
158
160
  if keys.empty?
159
161
  raise ScriptError, "Could not find param for polymorphic association. The request " <<
@@ -1,5 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module InheritedResources
2
4
  class Responder < ActionController::Responder
3
5
  include Responders::FlashResponder
6
+
7
+ self.error_status = :unprocessable_entity
8
+ self.redirect_status = :see_other
4
9
  end
5
10
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module InheritedResources
2
4
  # Shallow provides a functionality that goes on pair with Rails' shallow.
3
5
  # It is very similar to "optional" but it actually finds all the parents
@@ -33,7 +35,7 @@ module InheritedResources
33
35
  end
34
36
 
35
37
  def load_parents(instance, parent_symbols)
36
- parent_symbols.reverse.each do |parent|
38
+ parent_symbols.reverse_each do |parent|
37
39
  instance = instance.send(parent)
38
40
  config = resources_configuration[parent]
39
41
  params[config[:param]] = instance.to_param
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module InheritedResources
2
4
 
3
5
  # = singleton
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module InheritedResources
2
4
  # = URLHelpers
3
5
  #
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module InheritedResources
2
- VERSION = '1.13.1'.freeze
3
+ VERSION = '2.1.0'.freeze
3
4
  end
@@ -1,9 +1,12 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # This is here because responders don't require it.
2
4
  require 'rails/engine'
3
5
  require 'responders'
4
- require 'inherited_resources/engine'
5
- require 'inherited_resources/blank_slate'
6
- require 'inherited_resources/responder'
6
+
7
+ require_relative 'inherited_resources/engine'
8
+ require_relative 'inherited_resources/blank_slate'
9
+ require_relative 'inherited_resources/responder'
7
10
 
8
11
  module InheritedResources
9
12
  ACTIONS = [ :index, :show, :new, :edit, :create, :update, :destroy ] unless self.const_defined?(:ACTIONS)
@@ -23,18 +26,19 @@ module InheritedResources
23
26
  def self.flash_keys=(array)
24
27
  Responders::FlashResponder.flash_keys = array
25
28
  end
29
+
30
+ # Inherit from a different controller. This only has an effect if changed
31
+ # before InheritedResources::Base is loaded, e.g. in a rails initializer.
32
+ mattr_accessor(:parent_controller) { '::ApplicationController' }
26
33
  end
27
34
 
28
- ActiveSupport.on_load(:action_controller) do
29
- # We can remove this check and change to `on_load(:action_controller_base)` in Rails 5.2.
30
- if self == ActionController::Base
31
- # If you cannot inherit from InheritedResources::Base you can call
32
- # inherit_resources in your controller to have all the required modules and
33
- # funcionality included.
34
- def self.inherit_resources
35
- InheritedResources::Base.inherit_resources(self)
36
- initialize_resources_class_accessors!
37
- create_resources_url_helpers!
38
- end
35
+ ActiveSupport.on_load(:action_controller_base) do
36
+ # If you cannot inherit from InheritedResources::Base you can call
37
+ # inherit_resources in your controller to have all the required modules and
38
+ # functionality included.
39
+ def self.inherit_resources
40
+ InheritedResources::Base.inherit_resources(self)
41
+ initialize_resources_class_accessors!
42
+ create_resources_url_helpers!
39
43
  end
40
44
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inherited_resources
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.13.1
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - José Valim
8
8
  - Rafael Mendonça França
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2022-01-19 00:00:00.000000000 Z
12
+ date: 2024-12-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: responders
@@ -18,9 +18,6 @@ dependencies:
18
18
  - - ">="
19
19
  - !ruby/object:Gem::Version
20
20
  version: '2'
21
- - - "<"
22
- - !ruby/object:Gem::Version
23
- version: '4'
24
21
  type: :runtime
25
22
  prerelease: false
26
23
  version_requirements: !ruby/object:Gem::Requirement
@@ -28,67 +25,52 @@ dependencies:
28
25
  - - ">="
29
26
  - !ruby/object:Gem::Version
30
27
  version: '2'
31
- - - "<"
32
- - !ruby/object:Gem::Version
33
- version: '4'
34
28
  - !ruby/object:Gem::Dependency
35
29
  name: actionpack
36
30
  requirement: !ruby/object:Gem::Requirement
37
31
  requirements:
38
32
  - - ">="
39
33
  - !ruby/object:Gem::Version
40
- version: '5.2'
41
- - - "<"
42
- - !ruby/object:Gem::Version
43
- version: '7.1'
34
+ version: '7.0'
44
35
  type: :runtime
45
36
  prerelease: false
46
37
  version_requirements: !ruby/object:Gem::Requirement
47
38
  requirements:
48
39
  - - ">="
49
40
  - !ruby/object:Gem::Version
50
- version: '5.2'
51
- - - "<"
52
- - !ruby/object:Gem::Version
53
- version: '7.1'
41
+ version: '7.0'
54
42
  - !ruby/object:Gem::Dependency
55
43
  name: railties
56
44
  requirement: !ruby/object:Gem::Requirement
57
45
  requirements:
58
46
  - - ">="
59
47
  - !ruby/object:Gem::Version
60
- version: '5.2'
61
- - - "<"
62
- - !ruby/object:Gem::Version
63
- version: '7.1'
48
+ version: '7.0'
64
49
  type: :runtime
65
50
  prerelease: false
66
51
  version_requirements: !ruby/object:Gem::Requirement
67
52
  requirements:
68
53
  - - ">="
69
54
  - !ruby/object:Gem::Version
70
- version: '5.2'
71
- - - "<"
72
- - !ruby/object:Gem::Version
73
- version: '7.1'
55
+ version: '7.0'
74
56
  - !ruby/object:Gem::Dependency
75
57
  name: has_scope
76
58
  requirement: !ruby/object:Gem::Requirement
77
59
  requirements:
78
- - - "~>"
60
+ - - ">="
79
61
  - !ruby/object:Gem::Version
80
62
  version: '0.6'
81
63
  type: :runtime
82
64
  prerelease: false
83
65
  version_requirements: !ruby/object:Gem::Requirement
84
66
  requirements:
85
- - - "~>"
67
+ - - ">="
86
68
  - !ruby/object:Gem::Version
87
69
  version: '0.6'
88
70
  description: |
89
71
  Inherited Resources speeds up development by making your controllers inherit all restful actions so you just have to focus on what is important.
90
72
  It makes your controllers more powerful and cleaner at the same time.
91
- email:
73
+ email:
92
74
  executables: []
93
75
  extensions: []
94
76
  extra_rdoc_files: []
@@ -116,8 +98,9 @@ files:
116
98
  homepage: https://github.com/activeadmin/inherited_resources
117
99
  licenses:
118
100
  - MIT
119
- metadata: {}
120
- post_install_message:
101
+ metadata:
102
+ rubygems_mfa_required: 'true'
103
+ post_install_message:
121
104
  rdoc_options: []
122
105
  require_paths:
123
106
  - lib
@@ -125,15 +108,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
125
108
  requirements:
126
109
  - - ">="
127
110
  - !ruby/object:Gem::Version
128
- version: '2.5'
111
+ version: '3.1'
129
112
  required_rubygems_version: !ruby/object:Gem::Requirement
130
113
  requirements:
131
114
  - - ">="
132
115
  - !ruby/object:Gem::Version
133
116
  version: '0'
134
117
  requirements: []
135
- rubygems_version: 3.2.32
136
- signing_key:
118
+ rubygems_version: 3.5.22
119
+ signing_key:
137
120
  specification_version: 4
138
121
  summary: Inherited Resources speeds up development by making your controllers inherit
139
122
  all restful actions so you just have to focus on what is important.