roles_active_record 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -7,16 +7,16 @@ begin
7
7
  gem.email = "kmandrup@gmail.com"
8
8
  gem.homepage = "http://github.com/kristianmandrup/roles_for_dm"
9
9
  gem.authors = ["Kristian Mandrup"]
10
- gem.add_development_dependency "rspec", "~> 2.0.0"
10
+ gem.add_development_dependency "rspec", "~> 2.0.0.beta.22"
11
11
  gem.add_development_dependency 'database_cleaner', '~> 0.5.2'
12
- gem.add_development_dependency "generator-spec", '~> 0.6.1'
12
+ gem.add_development_dependency "generator-spec", '~> 0.6.5'
13
13
 
14
14
  gem.add_dependency "activerecord", "~> 3.0.0"
15
15
  gem.add_dependency "activesupport", "~> 3.0.0"
16
16
  gem.add_dependency "arel", "~> 1.0.0"
17
17
  gem.add_dependency "meta_where", "~> 0.9.3"
18
- gem.add_dependency "sugar-high", "~> 0.2.5"
19
- gem.add_dependency "require_all", '~> 1.1.0'
18
+ gem.add_dependency "sugar-high", "~> 0.2.11"
19
+ gem.add_dependency "require_all", '~> 1.2.0'
20
20
  gem.add_dependency "roles_generic", '~> 0.2.5'
21
21
 
22
22
  # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.1
1
+ 0.2.2
@@ -38,16 +38,20 @@ module RoleStrategy::ActiveRecord
38
38
  end
39
39
 
40
40
  # assign roles
41
- def roles=(*roles)
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(*roles)
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
47
49
 
48
- def add_roles(*roles)
49
- raise "Role class #{role_class} does not have a #find_role(role) method" if !role_class.respond_to? :find_role
50
- role_relations = role_class.find_roles(*roles)
50
+ def add_roles(*_roles)
51
+ _roles = get_roles(_roles)
52
+ return nil if _roles.none?
53
+
54
+ role_relations = role_class.find_roles(_roles)
51
55
  puts "role_relations: #{role_relations.inspect}"
52
56
  self.send(role_attribute) << role_relations
53
57
  save
@@ -27,10 +27,11 @@ module RoleStrategy::ActiveRecord
27
27
 
28
28
  module Implementation
29
29
  # assign roles
30
- def roles=(*roles)
31
- raise "Role class #{role_class} does not have a #find_role(role) method" if !role_class.respond_to? :find_role
32
- first_role = roles.flatten.first
33
- role_relation = role_class.find_role(first_role)
30
+ def roles=(*_roles)
31
+ _roles = get_roles(_roles)
32
+ return nil if _roles.none?
33
+
34
+ role_relation = role_class.find_role(_roles.first)
34
35
  self.send("#{role_attribute}=", role_relation)
35
36
  end
36
37
  alias_method :role=, :roles=
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{roles_active_record}
8
- s.version = "0.2.1"
8
+ s.version = "0.2.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-13}
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 Active Record}
14
14
  s.email = %q{kmandrup@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -133,38 +133,38 @@ Gem::Specification.new do |s|
133
133
  s.specification_version = 3
134
134
 
135
135
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
136
- s.add_development_dependency(%q<rspec>, ["~> 2.0.0"])
136
+ s.add_development_dependency(%q<rspec>, ["~> 2.0.0.beta.22"])
137
137
  s.add_development_dependency(%q<database_cleaner>, ["~> 0.5.2"])
138
- s.add_development_dependency(%q<generator-spec>, ["~> 0.6.1"])
138
+ s.add_development_dependency(%q<generator-spec>, ["~> 0.6.5"])
139
139
  s.add_runtime_dependency(%q<activerecord>, ["~> 3.0.0"])
140
140
  s.add_runtime_dependency(%q<activesupport>, ["~> 3.0.0"])
141
141
  s.add_runtime_dependency(%q<arel>, ["~> 1.0.0"])
142
142
  s.add_runtime_dependency(%q<meta_where>, ["~> 0.9.3"])
143
- s.add_runtime_dependency(%q<sugar-high>, ["~> 0.2.5"])
144
- s.add_runtime_dependency(%q<require_all>, ["~> 1.1.0"])
143
+ s.add_runtime_dependency(%q<sugar-high>, ["~> 0.2.11"])
144
+ s.add_runtime_dependency(%q<require_all>, ["~> 1.2.0"])
145
145
  s.add_runtime_dependency(%q<roles_generic>, ["~> 0.2.5"])
146
146
  else
147
- s.add_dependency(%q<rspec>, ["~> 2.0.0"])
147
+ s.add_dependency(%q<rspec>, ["~> 2.0.0.beta.22"])
148
148
  s.add_dependency(%q<database_cleaner>, ["~> 0.5.2"])
149
- s.add_dependency(%q<generator-spec>, ["~> 0.6.1"])
149
+ s.add_dependency(%q<generator-spec>, ["~> 0.6.5"])
150
150
  s.add_dependency(%q<activerecord>, ["~> 3.0.0"])
151
151
  s.add_dependency(%q<activesupport>, ["~> 3.0.0"])
152
152
  s.add_dependency(%q<arel>, ["~> 1.0.0"])
153
153
  s.add_dependency(%q<meta_where>, ["~> 0.9.3"])
154
- s.add_dependency(%q<sugar-high>, ["~> 0.2.5"])
155
- s.add_dependency(%q<require_all>, ["~> 1.1.0"])
154
+ s.add_dependency(%q<sugar-high>, ["~> 0.2.11"])
155
+ s.add_dependency(%q<require_all>, ["~> 1.2.0"])
156
156
  s.add_dependency(%q<roles_generic>, ["~> 0.2.5"])
157
157
  end
158
158
  else
159
- s.add_dependency(%q<rspec>, ["~> 2.0.0"])
159
+ s.add_dependency(%q<rspec>, ["~> 2.0.0.beta.22"])
160
160
  s.add_dependency(%q<database_cleaner>, ["~> 0.5.2"])
161
- s.add_dependency(%q<generator-spec>, ["~> 0.6.1"])
161
+ s.add_dependency(%q<generator-spec>, ["~> 0.6.5"])
162
162
  s.add_dependency(%q<activerecord>, ["~> 3.0.0"])
163
163
  s.add_dependency(%q<activesupport>, ["~> 3.0.0"])
164
164
  s.add_dependency(%q<arel>, ["~> 1.0.0"])
165
165
  s.add_dependency(%q<meta_where>, ["~> 0.9.3"])
166
- s.add_dependency(%q<sugar-high>, ["~> 0.2.5"])
167
- s.add_dependency(%q<require_all>, ["~> 1.1.0"])
166
+ s.add_dependency(%q<sugar-high>, ["~> 0.2.11"])
167
+ s.add_dependency(%q<require_all>, ["~> 1.2.0"])
168
168
  s.add_dependency(%q<roles_generic>, ["~> 0.2.5"])
169
169
  end
170
170
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 2
8
- - 1
9
- version: 0.2.1
8
+ - 2
9
+ version: 0.2.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-13 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
@@ -29,7 +29,9 @@ dependencies:
29
29
  - 2
30
30
  - 0
31
31
  - 0
32
- version: 2.0.0
32
+ - beta
33
+ - 22
34
+ version: 2.0.0.beta.22
33
35
  type: :development
34
36
  version_requirements: *id001
35
37
  - !ruby/object:Gem::Dependency
@@ -58,8 +60,8 @@ dependencies:
58
60
  segments:
59
61
  - 0
60
62
  - 6
61
- - 1
62
- version: 0.6.1
63
+ - 5
64
+ version: 0.6.5
63
65
  type: :development
64
66
  version_requirements: *id003
65
67
  - !ruby/object:Gem::Dependency
@@ -133,8 +135,8 @@ dependencies:
133
135
  segments:
134
136
  - 0
135
137
  - 2
136
- - 5
137
- version: 0.2.5
138
+ - 11
139
+ version: 0.2.11
138
140
  type: :runtime
139
141
  version_requirements: *id008
140
142
  - !ruby/object:Gem::Dependency
@@ -147,9 +149,9 @@ dependencies:
147
149
  - !ruby/object:Gem::Version
148
150
  segments:
149
151
  - 1
150
- - 1
152
+ - 2
151
153
  - 0
152
- version: 1.1.0
154
+ version: 1.2.0
153
155
  type: :runtime
154
156
  version_requirements: *id009
155
157
  - !ruby/object:Gem::Dependency