skinny_controllers 0.8.1 → 0.8.2
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d5bc252037caecc80eed0d9d1b90ba5607149773
|
4
|
+
data.tar.gz: 93607ed59083f50ffa65f761a6f386a07307e4f3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 56c48b1968618e9b0a91be46ea3670921e5c5172bc8c8d13c70e27fc4b5c7597495ee7a61e21284e64c12b87eda9fce7c432dd3b2e3dd8fd007619ed7060196a
|
7
|
+
data.tar.gz: fbea2fd3428467d7f61aa966bef7cb389b7eb1de95e2cae77d92eaef89ba3417b3786077ecb4eea189a0b839743382183309c2b5e4939f9312dc0530fc4dac0a
|
@@ -11,7 +11,7 @@ module SkinnyControllers
|
|
11
11
|
def operation_of(model_name, verb)
|
12
12
|
klass_name = Lookup::Operation.name_from_model(model_name, verb)
|
13
13
|
klass = klass_name.safe_constantize
|
14
|
-
klass || default_operation_class_for(model_name)
|
14
|
+
klass || default_operation_class_for(model_name, verb)
|
15
15
|
end
|
16
16
|
|
17
17
|
# @param [String] controller name of the controller class
|
@@ -26,12 +26,13 @@ module SkinnyControllers
|
|
26
26
|
# dynamically creates a module for the model if it
|
27
27
|
# isn't already defined
|
28
28
|
# @return [Class] default operation class
|
29
|
-
|
29
|
+
# @param [String] verb
|
30
|
+
def default_operation_class_for(model_name, verb)
|
30
31
|
default_operation = SkinnyControllers::Operation::Default
|
31
32
|
namespace = Lookup::Operation.default_operation_namespace_for(model_name)
|
32
33
|
|
33
|
-
default = "#{namespace.name}
|
34
|
-
default || namespace.const_set(
|
34
|
+
default = "#{namespace.name}::#{verb}".safe_constantize
|
35
|
+
default || namespace.const_set(verb, default_operation.dup)
|
35
36
|
end
|
36
37
|
|
37
38
|
# @return [Class] namespace for the default operation class
|
@@ -47,7 +47,8 @@ module SkinnyControllers
|
|
47
47
|
|
48
48
|
# this should be used when checking access to a single object
|
49
49
|
def read?(o = object)
|
50
|
-
o.send(accessible_method, user)
|
50
|
+
return o.send(accessible_method, user) if o.respond_to?(accessible_method)
|
51
|
+
default?
|
51
52
|
end
|
52
53
|
|
53
54
|
# this should be used when checking access to multilpe objects
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: skinny_controllers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- L. Preston Sego III
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-06-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -231,9 +231,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
231
231
|
version: '0'
|
232
232
|
requirements: []
|
233
233
|
rubyforge_project:
|
234
|
-
rubygems_version: 2.
|
234
|
+
rubygems_version: 2.6.4
|
235
235
|
signing_key:
|
236
236
|
specification_version: 4
|
237
|
-
summary: SkinnyControllers-0.8.
|
237
|
+
summary: SkinnyControllers-0.8.2
|
238
238
|
test_files: []
|
239
239
|
has_rdoc:
|