role_authorization 0.4.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
@@ -99,8 +99,6 @@ module RoleAuthorization
|
|
99
99
|
|
100
100
|
if hash
|
101
101
|
controller_klass = if self.controller_name == hash[:controller]
|
102
|
-
self
|
103
|
-
else
|
104
102
|
klass = (hash[:controller].camelize + "Controller").constantize.new
|
105
103
|
klass.params = hash
|
106
104
|
klass
|
@@ -110,6 +108,7 @@ module RoleAuthorization
|
|
110
108
|
end
|
111
109
|
rescue Exception => e
|
112
110
|
Rails.logger.error e.inspect
|
111
|
+
Rails.logger.error "when trying to #{method} #{path}"
|
113
112
|
e.backtrace.each {|line| Rails.logger.error line }
|
114
113
|
# continue on
|
115
114
|
end
|
@@ -20,7 +20,25 @@ module RoleAuthorization
|
|
20
20
|
|
21
21
|
url = url_for(options[:url] || record_or_name_or_array)
|
22
22
|
|
23
|
-
|
23
|
+
# pretty much taken from form_for to figure out
|
24
|
+
# the correct method to use
|
25
|
+
object = case record_or_name_or_array
|
26
|
+
when String, Symbol
|
27
|
+
nil
|
28
|
+
when Array
|
29
|
+
record_or_name_or_array.last
|
30
|
+
else
|
31
|
+
record_or_name_or_array
|
32
|
+
end
|
33
|
+
object = convert_to_model(object)
|
34
|
+
|
35
|
+
method = if options[:html] && options[:html].has_key?(:method)
|
36
|
+
options[:html][:method]
|
37
|
+
elsif object && object.respond_to?(:persisted?) && object.persisted?
|
38
|
+
:put
|
39
|
+
else
|
40
|
+
:post
|
41
|
+
end
|
24
42
|
|
25
43
|
if authorized?(url, method)
|
26
44
|
return form_for_open(record_or_name_or_array, *args, &proc)
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: role_authorization
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.4.
|
5
|
+
version: 0.4.2
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- John 'asceth' Long
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-04-
|
13
|
+
date: 2011-04-14 00:00:00 -04:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|