roles_mongo_mapper 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.1
1
+ 0.2.2
@@ -37,10 +37,10 @@ module MongoMapper
37
37
  protected
38
38
 
39
39
  extend Rails3::Assist::UseMacro
40
- use_orm :mongo_mapper
41
-
42
40
  include Rails3::Assist::BasicLogger
43
41
 
42
+ use_orm :mongo_mapper
43
+
44
44
  def logfile
45
45
  options[:logfile]
46
46
  end
@@ -3,7 +3,10 @@ module Roles::Base
3
3
  strategy_class.valid_roles = role_list.to_symbols
4
4
  if role_class_name
5
5
  role_list.each do |name|
6
- role_class_name.create(:name => name.to_s)
6
+ begin
7
+ role_class_name.create(:name => name.to_s)
8
+ rescue
9
+ end
7
10
  end
8
11
  end
9
12
  end
@@ -13,6 +16,8 @@ class Role
13
16
  include MongoMapper::Document
14
17
  key :name, String
15
18
 
19
+ validates_uniqueness_of :name
20
+
16
21
  scope :by_name, lambda { |name| where(:name => name.to_s) }
17
22
  scope :by_names, lambda { |*names| where(:name => names.to_strings) }
18
23
 
@@ -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.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-12-01}
12
+ s.date = %q{2010-12-21}
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 = [
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-12-01 00:00:00 +01:00
17
+ date: 2010-12-21 00:00:00 +01:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency