rolify 4.1.0 → 4.1.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: edae47a21706d1859520df05876acf68d95c0d48
4
- data.tar.gz: 09dbd84321d04321d1ef889db0911fa86f1ccbe4
3
+ metadata.gz: 1e51b0a50895b89514d5f41266e0eb5373d47158
4
+ data.tar.gz: d99233b97fd7e18a79b0958ef9d359d8266b58b3
5
5
  SHA512:
6
- metadata.gz: 910c97443cd78a0386a36f2d6645708c7f6eadf5b84815ca51f8b1cbd39f4a6e1236a16688c37ef99a48234deb44a25c684e7852ce146f7d0e75cc22817a841c
7
- data.tar.gz: 4525bec755d35bb470d364088bdfe2c7f2a39b61cf140944363518ed5626de9f4c438c088d432002a7b41edc750dccc7a032b94f76d075d068f0770b762223cb
6
+ metadata.gz: 0846e497eac805c2bcbd8227ae96efe949e337c4872f9b6295c1df4c32df2699702ebcd957f516204d7c28948aca8557391b2b17da9d9db4da1079d130d8f144
7
+ data.tar.gz: 5ca314c4b2c63b9897f60e948c28310dcd9ebb5623614831fb1b5368a290090987829e31bc388d297a7665ee753cd2dd6e045c2c28d6eda4910f902ab79e7740
@@ -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
@@ -1,3 +1,6 @@
1
+ = 4.1.1 (Aug 06, 2015)
2
+ * Fix a regression in the dynamic method loader.
3
+
1
4
  = 4.1.0 (Aug 04, 2015)
2
5
  * added `without_role` method for resources and classes
3
6
  * fix `has_role?` with :any and an unsaved user
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.with_all_roles([:admin, :user], current_user)
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 ]
@@ -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'] == 'mongoid'
7
- # for compatibility with MongoidDB - does not support polymorphic includes
8
- self.role_class.all.each do |r|
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
- # otherwise should be able to support polymorphic includes.
13
- # supported Rails version >= 3.2 with AR should use find_each, since use of .all.each is deprecated
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
@@ -1,3 +1,3 @@
1
1
  module Rolify
2
- VERSION = "4.1.0"
2
+ VERSION = "4.1.1"
3
3
  end
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.0
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-05 00:00:00.000000000 Z
11
+ date: 2015-08-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ammeter