cancan 1.3.2 → 1.3.3
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/CHANGELOG.rdoc
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
1.3.3 (August 20, 2010)
|
2
|
+
|
3
|
+
* Switching to Rspec namespace to remove deprecation warning in Rspec 2 - see issue #119
|
4
|
+
|
5
|
+
* Pluralize nested associations for conditions in accessible_by (thanks mlooney) - see issue #123
|
6
|
+
|
7
|
+
|
1
8
|
1.3.2 (August 7, 2010)
|
2
9
|
|
3
10
|
* Fixing slice error when passing in custom resource name - see issue #112
|
@@ -14,8 +21,7 @@
|
|
14
21
|
|
15
22
|
* Adding :singleton option to load_resource - see issue #93
|
16
23
|
|
17
|
-
* Supporting multiple resources in :through option for polymorphic
|
18
|
-
associations - see issue #73
|
24
|
+
* Supporting multiple resources in :through option for polymorphic associations - see issue #73
|
19
25
|
|
20
26
|
* Supporting Single Table Inheritance for "can" comparisons - see issue #55
|
21
27
|
|
@@ -34,14 +34,14 @@ module CanCan
|
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
tableized_conditions[name] = value
|
43
|
-
tableized_conditions
|
37
|
+
def tableized_conditions(conditions = @conditions)
|
38
|
+
conditions.inject({}) do |result_hash, (name, value)|
|
39
|
+
if value.kind_of? Hash
|
40
|
+
name = name.to_s.tableize.to_sym
|
41
|
+
value = tableized_conditions(value)
|
44
42
|
end
|
43
|
+
result_hash[name] = value
|
44
|
+
result_hash
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
data/lib/cancan/matchers.rb
CHANGED
@@ -31,8 +31,8 @@ describe CanCan::ActiveRecordAdditions do
|
|
31
31
|
@ability.can :read, @model_class, :too => {:car => 1, :far => {:bar => 1}}
|
32
32
|
|
33
33
|
condition_variants = [
|
34
|
-
'(toos.
|
35
|
-
'(toos.car=1 AND toos.
|
34
|
+
'(toos.fars.bar=1 AND toos.car=1) OR (foos.bar=1)', # faked sql sanitizer is stupid ;-)
|
35
|
+
'(toos.car=1 AND toos.fars.bar=1) OR (foos.bar=1)'
|
36
36
|
]
|
37
37
|
joins_variants = [
|
38
38
|
[:foo, {:too => [:far]}],
|
@@ -31,6 +31,18 @@ describe CanCan::CanDefinition do
|
|
31
31
|
@can.associations_hash.should == {:foo => {:bar => {}}}
|
32
32
|
end
|
33
33
|
|
34
|
+
it "should tableize correctly for absurdly complex permissions" do
|
35
|
+
@conditions[:unit] = {:property=>{:landlord=>{:weasle_id=>560}}}
|
36
|
+
@conditions[:test] = 1
|
37
|
+
@can.tableized_conditions.should == {:units => {:properties => {:landlords=>{:weasle_id=>560}}}, :test => 1}
|
38
|
+
end
|
39
|
+
|
40
|
+
it "should tableize correctly for complex permissions" do
|
41
|
+
@conditions[:unit] = {:property=>{:landlord_id=>560}}
|
42
|
+
@conditions[:test] = 1
|
43
|
+
@can.tableized_conditions.should == {:units => {:properties => {:landlord_id=>560}}, :test => 1}
|
44
|
+
end
|
45
|
+
|
34
46
|
it "should return table names in conditions for association joins" do
|
35
47
|
@conditions[:foo] = {:bar => 1}
|
36
48
|
@conditions[:test] = 1
|
metadata
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cancan
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 1
|
7
|
+
- 3
|
8
|
+
- 3
|
9
|
+
version: 1.3.3
|
5
10
|
platform: ruby
|
6
11
|
authors:
|
7
12
|
- Ryan Bates
|
@@ -9,7 +14,7 @@ autorequire:
|
|
9
14
|
bindir: bin
|
10
15
|
cert_chain: []
|
11
16
|
|
12
|
-
date: 2010-08-
|
17
|
+
date: 2010-08-20 00:00:00 -07:00
|
13
18
|
default_executable:
|
14
19
|
dependencies: []
|
15
20
|
|
@@ -60,18 +65,22 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
60
65
|
requirements:
|
61
66
|
- - ">="
|
62
67
|
- !ruby/object:Gem::Version
|
68
|
+
segments:
|
69
|
+
- 0
|
63
70
|
version: "0"
|
64
|
-
version:
|
65
71
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
66
72
|
requirements:
|
67
73
|
- - ">="
|
68
74
|
- !ruby/object:Gem::Version
|
75
|
+
segments:
|
76
|
+
- 1
|
77
|
+
- 3
|
78
|
+
- 4
|
69
79
|
version: 1.3.4
|
70
|
-
version:
|
71
80
|
requirements: []
|
72
81
|
|
73
82
|
rubyforge_project: cancan
|
74
|
-
rubygems_version: 1.3.
|
83
|
+
rubygems_version: 1.3.6
|
75
84
|
signing_key:
|
76
85
|
specification_version: 3
|
77
86
|
summary: Simple authorization solution for Rails.
|