cancancan 1.9.1 → 1.9.2

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: 2a9375725d7b71cd77d1b5b6e656b7f18b385100
4
- data.tar.gz: 5a3f75a4ae4cafb42203a2da807a8356464721a0
3
+ metadata.gz: 72e7c59df453fdbf97f4f3f9daf1faa01f102af1
4
+ data.tar.gz: a939e62999f39b20089742ebf5d12e1d384cabc4
5
5
  SHA512:
6
- metadata.gz: 2b8a66a63e8d26543bcf3c6ca51f3fc0ebfb521286ffa305edb4afad0f30753b494a9bb3545e3e89f2f51520cdd152e54f3f3d382239c26b9544a9b9cd367177
7
- data.tar.gz: c902e442088933cd9291444c99c19a45340c3a6bef6c08b193d8065e197b5da3e138077db28d088b71f2bb9b17ac800e342c8cecfcb4871c9acf701cb8884f32
6
+ metadata.gz: 32a8944af1356a883b6bb9365afddce4d89a66a3fbf3c84d5351531091f7d7533644e48b44515303dc2c5a19a39399b91189fb19dfd73574206f7ca06adf30b9
7
+ data.tar.gz: 904cd58c86b3af22979dfe44cd802c44035e3a15c241efd0c35e65a8c3369bd88047e8731e180ad557fe820f19d113ff82a9f49644495a5b5e950f2e0b8a82e2
@@ -1,6 +1,11 @@
1
1
  Develop
2
2
 
3
3
 
4
+ 1.9.2 (August 8th, 2014)
5
+
6
+ * Fix cancancan#77, 78 - Fix an issue with associations for namespaced models. (jjp)
7
+
8
+
4
9
  1.9.1 (July 21st, 2014)
5
10
 
6
11
  * Fix cancancan#101 - Fixes an issue where overjealous use of references would cause issues with scopes when loading associations. (bryanrite)
@@ -32,7 +32,7 @@ module CanCan
32
32
  conditions.inject({}) do |result_hash, (name, value)|
33
33
  if value.kind_of? Hash
34
34
  value = value.dup
35
- association_class = model_class.reflect_on_association(name).class_name.constantize
35
+ association_class = model_class.reflect_on_association(name).klass.name.constantize
36
36
  nested = value.inject({}) do |nested,(k,v)|
37
37
  if v.kind_of? Hash
38
38
  value.delete(k)
@@ -1,3 +1,3 @@
1
1
  module CanCan
2
- VERSION = "1.9.1"
2
+ VERSION = "1.9.2"
3
3
  end
@@ -342,6 +342,45 @@ if defined? CanCan::ModelAdapters::ActiveRecordAdapter
342
342
  expect { @ability.can? :read, Article }.not_to raise_error
343
343
  end
344
344
 
345
+ context "with namespaced models" do
346
+ before :each do
347
+ ActiveRecord::Schema.define do
348
+ create_table( :table_xes ) do |t|
349
+ t.timestamps
350
+ end
351
+
352
+ create_table( :table_zs ) do |t|
353
+ t.integer :table_x_id
354
+ t.integer :user_id
355
+ t.timestamps
356
+ end
357
+ end
358
+
359
+ module Namespace
360
+ end
361
+
362
+ class Namespace::TableX < ActiveRecord::Base
363
+ has_many :table_zs
364
+ end
365
+
366
+ class Namespace::TableZ < ActiveRecord::Base
367
+ belongs_to :table_x
368
+ belongs_to :user
369
+ end
370
+ end
371
+
372
+ it "fetches all namespace::table_x when one is related by table_y" do
373
+ user = User.create!
374
+
375
+ ability = Ability.new(user)
376
+ ability.can :read, Namespace::TableX, :table_zs => { :user_id => user.id }
377
+
378
+ table_x = Namespace::TableX.create!
379
+ table_z = table_x.table_zs.create( :user => user )
380
+ expect(Namespace::TableX.accessible_by(ability)).to eq([table_x])
381
+ end
382
+ end
383
+
345
384
  context "when MetaWhere is defined" do
346
385
  before :each do
347
386
  pending "[Deprecated] MetaWhere support is being removed" unless defined? MetaWhere
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.1
4
+ version: 1.9.2
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-21 00:00:00.000000000 Z
12
+ date: 2014-08-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler