roles_mongo_mapper 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -9,13 +9,13 @@ begin
9
9
  gem.authors = ["Kristian Mandrup"]
10
10
 
11
11
  gem.add_development_dependency "rspec", "~> 2.0.0.beta.22"
12
- gem.add_development_dependency 'generator-spec', "~> 0.6.4"
12
+ gem.add_development_dependency 'generator-spec', "~> 0.6.5"
13
13
 
14
14
  gem.add_dependency "mongo_mapper", '~> 0.8.4'
15
15
  gem.add_dependency "activesupport", '~> 3.0.0'
16
- gem.add_dependency "require_all", '~> 1.1.0'
17
- gem.add_dependency "sugar-high", '~> 0.2.10'
18
- gem.add_dependency "roles_generic", '~> 0.2.6'
16
+ gem.add_dependency "require_all", '~> 1.2.0'
17
+ gem.add_dependency "sugar-high", '~> 0.2.11'
18
+ gem.add_dependency "roles_generic", '~> 0.2.7'
19
19
  gem.add_dependency 'logging_assist', '~> 0.1.3'
20
20
 
21
21
  end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.1.2
@@ -38,9 +38,11 @@ module RoleStrategy::MongoMapper
38
38
  end
39
39
 
40
40
  # assign roles
41
- def roles=(*role_names)
42
- raise "Role class #{role_class} does not have a #find_role(role) method" if !role_class.respond_to? :find_role
43
- role_relations = role_class.find_roles(*role_names)
41
+ def roles=(*_roles)
42
+ _roles = get_roles(_roles)
43
+ return nil if _roles.none?
44
+
45
+ role_relations = role_class.find_roles(_roles)
44
46
  self.send("#{role_attribute}=", role_relations)
45
47
  save
46
48
  end
@@ -46,10 +46,11 @@ module RoleStrategy::MongoMapper
46
46
  end
47
47
 
48
48
  # assign roles
49
- def roles=(*roles)
50
- raise "Role class #{role_class} does not have a #find_role(role) method" if !role_class.respond_to? :find_role
51
- first_role = roles.flatten.first
52
- role_relation = role_class.find_role(first_role)
49
+ def roles=(*_roles)
50
+ _roles = get_roles(_roles)
51
+ return nil if _roles.none?
52
+
53
+ role_relation = role_class.find_role(_roles.first)
53
54
  if role_relation
54
55
  self.send("#{role_attribute}=", role_relation)
55
56
  self.send("#{role_id_attribute}=", role_relation.id)
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{roles_mongo_mapper}
8
- s.version = "0.1.1"
8
+ s.version = "0.1.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Kristian Mandrup"]
12
- s.date = %q{2010-09-20}
12
+ s.date = %q{2010-09-23}
13
13
  s.description = %q{Makes it easy to set a role strategy on your User model in MongoMapper}
14
14
  s.email = %q{kmandrup@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -72,31 +72,31 @@ Gem::Specification.new do |s|
72
72
 
73
73
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
74
74
  s.add_development_dependency(%q<rspec>, ["~> 2.0.0.beta.22"])
75
- s.add_development_dependency(%q<generator-spec>, ["~> 0.6.4"])
75
+ s.add_development_dependency(%q<generator-spec>, ["~> 0.6.5"])
76
76
  s.add_runtime_dependency(%q<mongo_mapper>, ["~> 0.8.4"])
77
77
  s.add_runtime_dependency(%q<activesupport>, ["~> 3.0.0"])
78
- s.add_runtime_dependency(%q<require_all>, ["~> 1.1.0"])
79
- s.add_runtime_dependency(%q<sugar-high>, ["~> 0.2.10"])
80
- s.add_runtime_dependency(%q<roles_generic>, ["~> 0.2.6"])
78
+ s.add_runtime_dependency(%q<require_all>, ["~> 1.2.0"])
79
+ s.add_runtime_dependency(%q<sugar-high>, ["~> 0.2.11"])
80
+ s.add_runtime_dependency(%q<roles_generic>, ["~> 0.2.7"])
81
81
  s.add_runtime_dependency(%q<logging_assist>, ["~> 0.1.3"])
82
82
  else
83
83
  s.add_dependency(%q<rspec>, ["~> 2.0.0.beta.22"])
84
- s.add_dependency(%q<generator-spec>, ["~> 0.6.4"])
84
+ s.add_dependency(%q<generator-spec>, ["~> 0.6.5"])
85
85
  s.add_dependency(%q<mongo_mapper>, ["~> 0.8.4"])
86
86
  s.add_dependency(%q<activesupport>, ["~> 3.0.0"])
87
- s.add_dependency(%q<require_all>, ["~> 1.1.0"])
88
- s.add_dependency(%q<sugar-high>, ["~> 0.2.10"])
89
- s.add_dependency(%q<roles_generic>, ["~> 0.2.6"])
87
+ s.add_dependency(%q<require_all>, ["~> 1.2.0"])
88
+ s.add_dependency(%q<sugar-high>, ["~> 0.2.11"])
89
+ s.add_dependency(%q<roles_generic>, ["~> 0.2.7"])
90
90
  s.add_dependency(%q<logging_assist>, ["~> 0.1.3"])
91
91
  end
92
92
  else
93
93
  s.add_dependency(%q<rspec>, ["~> 2.0.0.beta.22"])
94
- s.add_dependency(%q<generator-spec>, ["~> 0.6.4"])
94
+ s.add_dependency(%q<generator-spec>, ["~> 0.6.5"])
95
95
  s.add_dependency(%q<mongo_mapper>, ["~> 0.8.4"])
96
96
  s.add_dependency(%q<activesupport>, ["~> 3.0.0"])
97
- s.add_dependency(%q<require_all>, ["~> 1.1.0"])
98
- s.add_dependency(%q<sugar-high>, ["~> 0.2.10"])
99
- s.add_dependency(%q<roles_generic>, ["~> 0.2.6"])
97
+ s.add_dependency(%q<require_all>, ["~> 1.2.0"])
98
+ s.add_dependency(%q<sugar-high>, ["~> 0.2.11"])
99
+ s.add_dependency(%q<roles_generic>, ["~> 0.2.7"])
100
100
  s.add_dependency(%q<logging_assist>, ["~> 0.1.3"])
101
101
  end
102
102
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 1
9
- version: 0.1.1
8
+ - 2
9
+ version: 0.1.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - Kristian Mandrup
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-09-20 00:00:00 +02:00
17
+ date: 2010-09-23 00:00:00 +02:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -45,8 +45,8 @@ dependencies:
45
45
  segments:
46
46
  - 0
47
47
  - 6
48
- - 4
49
- version: 0.6.4
48
+ - 5
49
+ version: 0.6.5
50
50
  type: :development
51
51
  version_requirements: *id002
52
52
  - !ruby/object:Gem::Dependency
@@ -89,9 +89,9 @@ dependencies:
89
89
  - !ruby/object:Gem::Version
90
90
  segments:
91
91
  - 1
92
- - 1
92
+ - 2
93
93
  - 0
94
- version: 1.1.0
94
+ version: 1.2.0
95
95
  type: :runtime
96
96
  version_requirements: *id005
97
97
  - !ruby/object:Gem::Dependency
@@ -105,8 +105,8 @@ dependencies:
105
105
  segments:
106
106
  - 0
107
107
  - 2
108
- - 10
109
- version: 0.2.10
108
+ - 11
109
+ version: 0.2.11
110
110
  type: :runtime
111
111
  version_requirements: *id006
112
112
  - !ruby/object:Gem::Dependency
@@ -120,8 +120,8 @@ dependencies:
120
120
  segments:
121
121
  - 0
122
122
  - 2
123
- - 6
124
- version: 0.2.6
123
+ - 7
124
+ version: 0.2.7
125
125
  type: :runtime
126
126
  version_requirements: *id007
127
127
  - !ruby/object:Gem::Dependency