cancan_namespace 0.1.1 → 0.1.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.
- data/lib/cancan_namespace/rule.rb +7 -1
- data/lib/cancan_namespace/version.rb +1 -1
- metadata +4 -4
@@ -8,8 +8,14 @@ module CanCanNamespace
|
|
8
8
|
# and subject respectively (such as :read, @project). The third argument is a hash
|
9
9
|
# of conditions and the last one is the block passed to the "can" call.
|
10
10
|
def initialize(base_behavior, action, subject, conditions, block)
|
11
|
+
if conditions.kind_of?(Hash) && conditions.has_key?(:context)
|
12
|
+
@contexts = [conditions.delete(:context)].flatten.map(&:to_s)
|
13
|
+
conditions = nil if conditions.keys.empty?
|
14
|
+
else
|
15
|
+
@contexts = []
|
16
|
+
end
|
17
|
+
|
11
18
|
super
|
12
|
-
@contexts = has_conditions? && @conditions.has_key?(:context) ? [@conditions.delete(:context)].flatten.map(&:to_s) : []
|
13
19
|
end
|
14
20
|
|
15
21
|
def has_conditions?
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cancan_namespace
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 31
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 2
|
10
|
+
version: 0.1.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Igor Galeta
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2011-
|
19
|
+
date: 2011-04-09 00:00:00 +03:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|