petergate 1.6.8 → 1.6.9

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: 266c473c940d039ad1098a27bd8a4ae3920b130d
4
- data.tar.gz: 08c543814c39ca17f9436bfeb2ef369b6b2f5284
3
+ metadata.gz: 6fbfe5d59028ab9f3a7c6a316749e418891fe828
4
+ data.tar.gz: 5f1dd98aaab461d6bad65f79309b7f781a96d179
5
5
  SHA512:
6
- metadata.gz: f8b185bf7b5d2315bab81d230ed46b33bb440171d2080974b755a69f223bab325bc07b777f586184fc25318144384fd0a2d070b43ec2430048801cf2d9208d16
7
- data.tar.gz: d16bc5c3607cc1d4480b4fbc254eaede8fcaf13f29718fb68464b0036665fa7d89a7c277ad15d59bdede8c4fdfeebd8d9fc1295f3988a7be43507931842aba42
6
+ metadata.gz: 94052faaf85168e86dc4ce03a12ce99bb497f7f6dd394f866b0480bd8d321d4cad8eaac7d11544a27703226f778efc4996ead361349717f0845c751dcf82105b
7
+ data.tar.gz: c804f26772a9e6048767b20c049dd3aaf7456ca34d2f462643014fb0a53734faea146e8b4e083614e6c71b8b9d2c316c10f7c63ec574187d36782eb149c3494c
data/README.md CHANGED
@@ -46,7 +46,7 @@ This will add a migration and insert petergate into your User model.
46
46
 
47
47
  Usage
48
48
  ------
49
- #####User Model
49
+ ####User Model
50
50
 
51
51
  Configure available roles by modifying this block at the top of your user.rb.
52
52
 
@@ -60,9 +60,20 @@ petergate(roles: [:admin, :editor], multiple: false)
60
60
  ############################################################################################
61
61
  ```
62
62
 
63
- Instance methods added to your User model include: `role, roles, roles=, available_roles`
63
+ ##### Instance Methods
64
64
 
65
- #####Controllers
65
+ ```ruby
66
+ user.role => :editor
67
+ user.roles => [:editor, :user]
68
+ user.roles=(v) #sets roles
69
+ user.available_roles => [:admin, :editor]
70
+ user.has_roles?(:admin, :editors) # returns true if user is any of roles passed in as params.
71
+ ```
72
+ ##### Class Methods
73
+
74
+ `User.role_editors => #list of editors. Method is created for all roles. role_admins, role_teachers, etc.`
75
+
76
+ ####Controllers
66
77
 
67
78
  Setup permissions in your controllers the same as you would for a before filter like so:
68
79
 
@@ -48,7 +48,7 @@ module Petergate
48
48
  v
49
49
  when "Array"
50
50
  v.first
51
- end
51
+ end.to_sym
52
52
  self[:roles] = available_roles.include?(r) ? r : :user
53
53
  end
54
54
  end
@@ -1,3 +1,3 @@
1
1
  module Petergate
2
- VERSION = "1.6.8"
2
+ VERSION = "1.6.9"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: petergate
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.8
4
+ version: 1.6.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Isaac Sloan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-05 00:00:00.000000000 Z
11
+ date: 2016-07-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler