rolify 4.1.0 → 4.1.1
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.
- checksums.yaml +4 -4
- data/.travis.yml +4 -28
- data/CHANGELOG.rdoc +3 -0
- data/README.md +3 -1
- data/lib/rolify/dynamic.rb +5 -6
- data/lib/rolify/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1e51b0a50895b89514d5f41266e0eb5373d47158
|
4
|
+
data.tar.gz: d99233b97fd7e18a79b0958ef9d359d8266b58b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0846e497eac805c2bcbd8227ae96efe949e337c4872f9b6295c1df4c32df2699702ebcd957f516204d7c28948aca8557391b2b17da9d9db4da1079d130d8f144
|
7
|
+
data.tar.gz: 5ca314c4b2c63b9897f60e948c28310dcd9ebb5623614831fb1b5368a290090987829e31bc388d297a7665ee753cd2dd6e045c2c28d6eda4910f902ab79e7740
|
data/.travis.yml
CHANGED
@@ -1,7 +1,11 @@
|
|
1
1
|
language: ruby
|
2
|
+
sudo: false
|
2
3
|
|
3
4
|
rvm:
|
5
|
+
- 2.2.2
|
4
6
|
- 2.1.2
|
7
|
+
- 2.0.0
|
8
|
+
|
5
9
|
|
6
10
|
before_install:
|
7
11
|
- gem update --system
|
@@ -19,31 +23,3 @@ services: mongodb
|
|
19
23
|
addons:
|
20
24
|
code_climate:
|
21
25
|
repo_token: 6bd8d374b120a5449b9a4b7dfda40cc0609dbade48a1b6655f04a9bc8de3a3ee
|
22
|
-
# language: ruby
|
23
|
-
#
|
24
|
-
# rvm:
|
25
|
-
# - 1.9.3
|
26
|
-
# - 2.0.0
|
27
|
-
# - 2.1.1
|
28
|
-
# - 2.1.2
|
29
|
-
# - rbx-2
|
30
|
-
# - jruby-19mode
|
31
|
-
#
|
32
|
-
# script: bundle exec rake
|
33
|
-
#
|
34
|
-
# gemfile:
|
35
|
-
# - gemfiles/Gemfile.rails-3.2
|
36
|
-
# - gemfiles/Gemfile.rails-4.0
|
37
|
-
# - gemfiles/Gemfile.rails-4.1
|
38
|
-
#
|
39
|
-
# env:
|
40
|
-
# - ADAPTER=active_record
|
41
|
-
# - ADAPTER=mongoid
|
42
|
-
#
|
43
|
-
# services: mongodb
|
44
|
-
#
|
45
|
-
# matrix:
|
46
|
-
# fast_finish: true
|
47
|
-
# exclude:
|
48
|
-
# - rvm: 1.9.3
|
49
|
-
# gemfile: gemfiles/Gemfile.rails-4.1
|
data/CHANGELOG.rdoc
CHANGED
data/README.md
CHANGED
@@ -183,7 +183,7 @@ Forum.with_role(:admin)
|
|
183
183
|
# => [ list of Forum instances that has role "admin" binded to it ]
|
184
184
|
Forum.with_role(:admin, current_user)
|
185
185
|
# => [ list of Forum instances that has role "admin" binded to it and belongs to current_user roles ]
|
186
|
-
Forum.
|
186
|
+
Forum.with_roles([:admin, :user], current_user)
|
187
187
|
# => [ list of Forum instances that has role "admin" or "user" binded to it and belongs to current_user roles ]
|
188
188
|
|
189
189
|
User.with_any_role(:user, :admin)
|
@@ -192,6 +192,8 @@ User.with_role(:site_admin, current_site)
|
|
192
192
|
# => [ list of User instances that have a scoped role of "site_admin" to a site instance ]
|
193
193
|
User.with_role(:site_admin, :any)
|
194
194
|
# => [ list of User instances that have a scoped role of "site_admin" for any site instances ]
|
195
|
+
User.with_all_roles(:site_admin, :admin)
|
196
|
+
# => [ list of User instances that have a role of "site_admin" and a role of "admin" binded to it ]
|
195
197
|
|
196
198
|
Forum.find_roles
|
197
199
|
# => [ list of roles that binded to any Forum instance or to the Forum class ]
|
data/lib/rolify/dynamic.rb
CHANGED
@@ -3,15 +3,14 @@ require "rolify/configure"
|
|
3
3
|
module Rolify
|
4
4
|
module Dynamic
|
5
5
|
def load_dynamic_methods
|
6
|
-
if ENV['ADAPTER'] == '
|
7
|
-
#
|
8
|
-
self.role_class.
|
6
|
+
if ENV['ADAPTER'] == 'active_record'
|
7
|
+
# supported Rails version >= 3.2 with AR should use find_each, since use of .all.each is deprecated
|
8
|
+
self.role_class.includes(:resource).find_each do |r|
|
9
9
|
define_dynamic_method(r.name, r.resource)
|
10
10
|
end
|
11
11
|
else
|
12
|
-
#
|
13
|
-
|
14
|
-
self.role_class.includes(:resource).find_each do |r|
|
12
|
+
# for compatibility with MongoidDB and older Rails AR - does not support polymorphic includes
|
13
|
+
self.role_class.all.each do |r|
|
15
14
|
define_dynamic_method(r.name, r.resource)
|
16
15
|
end
|
17
16
|
end
|
data/lib/rolify/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rolify
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.1.
|
4
|
+
version: 4.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Florent Monbillard
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-08-
|
11
|
+
date: 2015-08-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ammeter
|