inherited_resources 2.0.1 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aaebb8b497c48f9057e36c1dcf828487b28fec89e6b71c586b358e402fd34984
|
4
|
+
data.tar.gz: 5e52d03746f0c38b5dc1babb70e52e8f0c563613e67fa6ce1169e0ec130472e7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fcdda43c097f8a9e75d5711ca5268b6b4b01c0462bd46084b30e48d880fdd2334399885f54dc966f6ecbac38390c25805c5f31333e467c892be2ae3a10afc9a0
|
7
|
+
data.tar.gz: ec4aede5a01a46cc309e2254d2817d4d9e5a134f15dec60590c1473ce723c5a170152188e89048ace1aae0c2d2cf54b81cdb25628b1b6ac1dcbf47dccef49276
|
data/README.md
CHANGED
@@ -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.
|
@@ -9,7 +9,7 @@ module InheritedResources
|
|
9
9
|
# call <tt>default</tt> class method, call <<tt>actions</tt> class method
|
10
10
|
# or overwrite some helpers in the base_helpers.rb file.
|
11
11
|
#
|
12
|
-
class Base <
|
12
|
+
class Base < InheritedResources.parent_controller.constantize
|
13
13
|
# Overwrite inherit_resources to add specific InheritedResources behavior.
|
14
14
|
def self.inherit_resources(base)
|
15
15
|
base.class_eval do
|
@@ -153,9 +153,9 @@ module InheritedResources
|
|
153
153
|
if symbol == :polymorphic
|
154
154
|
params_keys = params.keys
|
155
155
|
|
156
|
-
keys = polymorphic_config[:symbols].
|
157
|
-
params_keys.include?(resources_configuration[poly][:param].to_s)
|
158
|
-
end
|
156
|
+
keys = polymorphic_config[:symbols].select do |poly|
|
157
|
+
params_keys.include?(resources_configuration[poly][:param].to_s)
|
158
|
+
end
|
159
159
|
|
160
160
|
if keys.empty?
|
161
161
|
raise ScriptError, "Could not find param for polymorphic association. The request " <<
|
data/lib/inherited_resources.rb
CHANGED
@@ -26,6 +26,10 @@ module InheritedResources
|
|
26
26
|
def self.flash_keys=(array)
|
27
27
|
Responders::FlashResponder.flash_keys = array
|
28
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' }
|
29
33
|
end
|
30
34
|
|
31
35
|
ActiveSupport.on_load(:action_controller_base) do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: inherited_resources
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- José Valim
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2024-
|
12
|
+
date: 2024-12-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: responders
|
@@ -31,28 +31,28 @@ dependencies:
|
|
31
31
|
requirements:
|
32
32
|
- - ">="
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: '
|
34
|
+
version: '7.0'
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
39
|
- - ">="
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version: '
|
41
|
+
version: '7.0'
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: railties
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
46
|
- - ">="
|
47
47
|
- !ruby/object:Gem::Version
|
48
|
-
version: '
|
48
|
+
version: '7.0'
|
49
49
|
type: :runtime
|
50
50
|
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
53
|
- - ">="
|
54
54
|
- !ruby/object:Gem::Version
|
55
|
-
version: '
|
55
|
+
version: '7.0'
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
57
|
name: has_scope
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
@@ -108,14 +108,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
108
108
|
requirements:
|
109
109
|
- - ">="
|
110
110
|
- !ruby/object:Gem::Version
|
111
|
-
version: '
|
111
|
+
version: '3.1'
|
112
112
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
113
113
|
requirements:
|
114
114
|
- - ">="
|
115
115
|
- !ruby/object:Gem::Version
|
116
116
|
version: '0'
|
117
117
|
requirements: []
|
118
|
-
rubygems_version: 3.5.
|
118
|
+
rubygems_version: 3.5.22
|
119
119
|
signing_key:
|
120
120
|
specification_version: 4
|
121
121
|
summary: Inherited Resources speeds up development by making your controllers inherit
|