skinny_controllers 0.8.1 → 0.8.2

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: bfc833504dfcb98816addf70327d77fc5b226266
4
- data.tar.gz: c8f44f79873234d5aa2c7cd0cd0a802ed30ae8f6
3
+ metadata.gz: d5bc252037caecc80eed0d9d1b90ba5607149773
4
+ data.tar.gz: 93607ed59083f50ffa65f761a6f386a07307e4f3
5
5
  SHA512:
6
- metadata.gz: b2af0e8182e1a556fbc990ad30d7f7b564772b2b89877f6d5b46470e870d6389f0ce5320a028ae2c511e63d7b6ca22daa94126ee3d11cf5dea7cd1fc6df59c18
7
- data.tar.gz: fe8314a6a8bb42d93df89b57c71127ec4d024012ab7352fc8998f1677800a60e2013ef17a0e57e0da24212d280406b4b5b2b66877a025f1af0858845ccc6d40a
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
- def default_operation_class_for(model_name)
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}::Default".safe_constantize
34
- default || namespace.const_set('Default'.freeze, default_operation.dup)
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
@@ -1,3 +1,3 @@
1
1
  module SkinnyControllers
2
- VERSION = '0.8.1'.freeze
2
+ VERSION = '0.8.2'.freeze
3
3
  end
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.1
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-05-08 00:00:00.000000000 Z
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.5.1
234
+ rubygems_version: 2.6.4
235
235
  signing_key:
236
236
  specification_version: 4
237
- summary: SkinnyControllers-0.8.1
237
+ summary: SkinnyControllers-0.8.2
238
238
  test_files: []
239
239
  has_rdoc: