cancancan 1.9.0 → 1.9.1
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2a9375725d7b71cd77d1b5b6e656b7f18b385100
|
4
|
+
data.tar.gz: 5a3f75a4ae4cafb42203a2da807a8356464721a0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2b8a66a63e8d26543bcf3c6ca51f3fc0ebfb521286ffa305edb4afad0f30753b494a9bb3545e3e89f2f51520cdd152e54f3f3d382239c26b9544a9b9cd367177
|
7
|
+
data.tar.gz: c902e442088933cd9291444c99c19a45340c3a6bef6c08b193d8065e197b5da3e138077db28d088b71f2bb9b17ac800e342c8cecfcb4871c9acf701cb8884f32
|
data/CHANGELOG.rdoc
CHANGED
@@ -1,6 +1,11 @@
|
|
1
1
|
Develop
|
2
2
|
|
3
3
|
|
4
|
+
1.9.1 (July 21st, 2014)
|
5
|
+
|
6
|
+
* Fix cancancan#101 - Fixes an issue where overjealous use of references would cause issues with scopes when loading associations. (bryanrite)
|
7
|
+
|
8
|
+
|
4
9
|
1.9.0 (July 20th, 2014)
|
5
10
|
|
6
11
|
* Fix cancancan#59 - Parameters are automatically detected and santitized for all actions, not just create and update. (bryanrite)
|
@@ -12,9 +12,10 @@ module CanCan
|
|
12
12
|
# look inside the where clause to decide to outer join tables
|
13
13
|
# you're using in the where. Instead, `references()` is required
|
14
14
|
# in addition to `includes()` to force the outer join.
|
15
|
-
#
|
16
15
|
def build_relation(*where_conditions)
|
17
|
-
@model_class.where(*where_conditions)
|
16
|
+
relation = @model_class.where(*where_conditions)
|
17
|
+
relation = relation.includes(joins).references(joins) if joins.present?
|
18
|
+
relation
|
18
19
|
end
|
19
20
|
end
|
20
21
|
end
|
data/lib/cancan/version.rb
CHANGED
@@ -0,0 +1,40 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
if defined? CanCan::ModelAdapters::ActiveRecord4Adapter
|
4
|
+
describe CanCan::ModelAdapters::ActiveRecord4Adapter do
|
5
|
+
before :each do
|
6
|
+
ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :database => ":memory:")
|
7
|
+
ActiveRecord::Migration.verbose = false
|
8
|
+
ActiveRecord::Schema.define do
|
9
|
+
create_table(:parents) do |t|
|
10
|
+
t.timestamps
|
11
|
+
end
|
12
|
+
|
13
|
+
create_table(:children) do |t|
|
14
|
+
t.timestamps
|
15
|
+
t.integer :parent_id
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
class Parent < ActiveRecord::Base
|
20
|
+
has_many :children, lambda { order(:id => :desc) }
|
21
|
+
end
|
22
|
+
|
23
|
+
class Child < ActiveRecord::Base
|
24
|
+
belongs_to :parent
|
25
|
+
end
|
26
|
+
|
27
|
+
(@ability = double).extend(CanCan::Ability)
|
28
|
+
end
|
29
|
+
|
30
|
+
it "respects scope on included associations" do
|
31
|
+
@ability.can :read, [Parent, Child]
|
32
|
+
|
33
|
+
parent = Parent.create!
|
34
|
+
child1 = Child.create!(:parent => parent, :created_at => 1.hours.ago)
|
35
|
+
child2 = Child.create!(:parent => parent, :created_at => 2.hours.ago)
|
36
|
+
|
37
|
+
expect(Parent.accessible_by(@ability).order(:created_at => :asc).includes(:children).first.children).to eq [child2, child1]
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cancancan
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.9.
|
4
|
+
version: 1.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bryan Rite
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-07-
|
12
|
+
date: 2014-07-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -123,6 +123,7 @@ files:
|
|
123
123
|
- spec/cancan/exceptions_spec.rb
|
124
124
|
- spec/cancan/inherited_resource_spec.rb
|
125
125
|
- spec/cancan/matchers_spec.rb
|
126
|
+
- spec/cancan/model_adapters/active_record_4_adapter_spec.rb
|
126
127
|
- spec/cancan/model_adapters/active_record_adapter_spec.rb
|
127
128
|
- spec/cancan/model_adapters/data_mapper_adapter_spec.rb
|
128
129
|
- spec/cancan/model_adapters/default_adapter_spec.rb
|
@@ -174,6 +175,7 @@ test_files:
|
|
174
175
|
- spec/cancan/exceptions_spec.rb
|
175
176
|
- spec/cancan/inherited_resource_spec.rb
|
176
177
|
- spec/cancan/matchers_spec.rb
|
178
|
+
- spec/cancan/model_adapters/active_record_4_adapter_spec.rb
|
177
179
|
- spec/cancan/model_adapters/active_record_adapter_spec.rb
|
178
180
|
- spec/cancan/model_adapters/data_mapper_adapter_spec.rb
|
179
181
|
- spec/cancan/model_adapters/default_adapter_spec.rb
|