skinny_controllers 0.5.2 → 0.5.3

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: f2e1ec3f77c39858d0b820f251510b79bcc3e4d2
4
- data.tar.gz: f3248c60ec78d9f32994db937966180d4c423a9b
3
+ metadata.gz: 17d5297816d2a7c0b58893b33a13bbc9b3325298
4
+ data.tar.gz: 1dc6ed173769df962b8a6716d5178b1abd07650a
5
5
  SHA512:
6
- metadata.gz: 06f7c1e5f83f884cf011db58efa12c09043483f7fbb506e67bd02758a711b93e54e5a3f1ea5aaf50fd38b306be080fe5b1e9e41c2e3e95268bba7700b5e6f258
7
- data.tar.gz: 35b555b099adb1ba915cc88da1c1f62b289de0aacdb6d8a0dea9e923462a992f6efaf0c5b554d9c357187e08b8ef8a0cfc7498ee5e7072b70f9fdf4196940e28
6
+ metadata.gz: f109e9e339bacf50c204a3a925e1e6dbd04f8dcb53acefa4e9ec647b27ddc36eb8b1fb8ef068ad96046ea9d5b7c33543ae66bb9bf2713ef43c69d4d008f4abc4
7
+ data.tar.gz: df06896ca96b9706afc6c91c43cd12d044e8bb028ebce4020dbbfe949d677a5ae537c68136ff493543cea87b4afdd40fa6e9d5cf50209bc1efd67752d0235392
@@ -62,13 +62,7 @@ module SkinnyControllers
62
62
  #
63
63
  # @example Operation::Event::Read would become read?
64
64
  def policy_method_name
65
- unless @policy_method_name
66
- method = Lookup::Policy.method_name_for_operation(self.class.name)
67
- has_method = policy_class.instance_methods.include?(method.to_sym)
68
- @policy_method_name = has_method ? method : 'default?'
69
- end
70
-
71
- @policy_method_name
65
+ @policy_method_name ||= Lookup::Policy.method_name_for_operation(self.class.name)
72
66
  end
73
67
 
74
68
  # @return a new policy object and caches it
@@ -14,6 +14,27 @@ module SkinnyControllers
14
14
  self.authorized_via_parent = authorized_via_parent
15
15
  end
16
16
 
17
+ # @param [Symbol] method_name
18
+ # @param [Array] args
19
+ # @param [Proc] block
20
+ def method_missing(method_name, *args, &block)
21
+ # if the method ends in a question mark, re-route to default
22
+ if method_name.to_s =~ /(.+)\?/
23
+ action = $1
24
+ # alias destroy to delete
25
+ # TODO: this means that a destroy method, if defined,
26
+ # will never be called.... good or bad?
27
+ # should there be a difference between delete and destroy?
28
+ return send('delete?'.freeze) if action == 'destroy'.freeze
29
+
30
+ # we know that these methods don't take any parameters,
31
+ # so args and block can be ignored
32
+ send(:default?)
33
+ else
34
+ super
35
+ end
36
+ end
37
+
17
38
  # if a method is not defined for a particular verb or action,
18
39
  # this will be used.
19
40
  #
@@ -1,3 +1,3 @@
1
1
  module SkinnyControllers
2
- VERSION = '0.5.2'
2
+ VERSION = '0.5.3'
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.5.2
4
+ version: 0.5.3
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: 2015-11-25 00:00:00.000000000 Z
11
+ date: 2015-11-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -224,5 +224,5 @@ rubyforge_project:
224
224
  rubygems_version: 2.4.8
225
225
  signing_key:
226
226
  specification_version: 4
227
- summary: SkinnyControllers-0.5.2
227
+ summary: SkinnyControllers-0.5.3
228
228
  test_files: []