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 CHANGED
@@ -1,3 +1,6 @@
1
+ = v0.0.5 (Aug 23, 2012)
2
+ * fix user_cname nil problem in User class
3
+
1
4
  = v0.0.4 (Aug 23, 2012)
2
5
  * fix method name error(roles -> rolify)
3
6
 
data/lib/roles/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Roles
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
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] || 'User'
32
+ self.user_cname = options[:user_cname]
31
33
  end
32
34
 
33
35
  def user_class
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: roles
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: