roles 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.rdoc +3 -0
- data/lib/roles/version.rb +1 -1
- data/lib/roles.rb +4 -2
- metadata +1 -1
data/CHANGELOG.rdoc
CHANGED
data/lib/roles/version.rb
CHANGED
data/lib/roles.rb
CHANGED
@@ -10,6 +10,7 @@ module Roles
|
|
10
10
|
include Role
|
11
11
|
|
12
12
|
options.reverse_merge!({:role_cname => 'Role'})
|
13
|
+
options.reverse_merge!({:user_cname => 'User'})
|
13
14
|
|
14
15
|
roles_options = { :class_name => options[:role_cname].camelize }
|
15
16
|
roles_options.merge!(options.select{ |k,v| [:before_add, :after_add, :before_remove, :after_remove].include? k.to_sym })
|
@@ -17,17 +18,18 @@ module Roles
|
|
17
18
|
has_many :roles, roles_options
|
18
19
|
|
19
20
|
self.role_cname = options[:role_cname]
|
21
|
+
self.user_cname = options[:user_cname]
|
20
22
|
end
|
21
23
|
|
22
24
|
def resourcify(options = {})
|
23
25
|
include Resource
|
24
26
|
|
25
|
-
options.reverse_merge!({ :role_cname => 'Role', :dependent => :destroy })
|
27
|
+
options.reverse_merge!({ :role_cname => 'Role', :dependent => :destroy, :user_cname => 'User' })
|
26
28
|
resourcify_options = { :class_name => options[:role_cname].camelize, :as => :resource, :dependent => options[:dependent] }
|
27
29
|
has_many :roles, resourcify_options
|
28
30
|
|
29
31
|
self.role_cname = options[:role_cname]
|
30
|
-
self.user_cname = options[:user_cname]
|
32
|
+
self.user_cname = options[:user_cname]
|
31
33
|
end
|
32
34
|
|
33
35
|
def user_class
|