walruz-rails 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/walruz/controller_mixin.rb +6 -3
- data/spec/scenario.rb +2 -2
- metadata +2 -2
@@ -2,8 +2,11 @@ module Walruz
|
|
2
2
|
module ControllerMixin
|
3
3
|
|
4
4
|
def self.included(base)
|
5
|
-
base.
|
6
|
-
|
5
|
+
base.class_eval do
|
6
|
+
include InstanceMethods
|
7
|
+
extend ClassMethods
|
8
|
+
helper_method(:policy_params)
|
9
|
+
end
|
7
10
|
end
|
8
11
|
|
9
12
|
module InstanceMethods
|
@@ -59,7 +62,7 @@ module Walruz
|
|
59
62
|
error_message = "There is neither an instance variable @%s nor a instance method %s on the %s instance context" % [subject, subject, controller.class.name]
|
60
63
|
raise ArgumentError.new(error_message)
|
61
64
|
end
|
62
|
-
params = controller.send(:current_user).authorize(action, subject_instance)
|
65
|
+
params = controller.send(:current_user).authorize!(action, subject_instance)
|
63
66
|
controller.set_policy_params!(params)
|
64
67
|
end
|
65
68
|
end
|
data/spec/scenario.rb
CHANGED
@@ -13,7 +13,7 @@ class Beatle
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def sing_the_song(song)
|
16
|
-
response = authorize(:sing, song)
|
16
|
+
response = authorize!(:sing, song)
|
17
17
|
case response[:owner]
|
18
18
|
when Colaboration
|
19
19
|
authors = response[:owner].authors.dup
|
@@ -26,7 +26,7 @@ class Beatle
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def sing_with_john(song)
|
29
|
-
authorize(:sing_with_john, song)
|
29
|
+
authorize!(:sing_with_john, song)
|
30
30
|
"Ok John, Let's Play '%s'" % song.name
|
31
31
|
end
|
32
32
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: walruz-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Roman Gonzalez
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-07-
|
12
|
+
date: 2009-07-13 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|