acts_as_label 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -1 +1,2 @@
1
- .DS_Store
1
+ .DS_Store
2
+ *.gem
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.5
1
+ 0.1.6
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{acts_as_label}
8
- s.version = "0.1.5"
8
+ s.version = "0.1.6"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Coroutine", "John Dugan"]
12
- s.date = %q{2010-03-25}
12
+ s.date = %q{2010-07-04}
13
13
  s.description = %q{This acts_as extension implements a system label and a friendly label on a class and centralizes the logic for performing validations and accessing items by system label.}
14
14
  s.email = %q{jdugan@coroutine.com}
15
15
  s.extra_rdoc_files = [
@@ -161,6 +161,15 @@ module Coroutine #:nodoc:
161
161
  self.send("#{acts_as_label_label_column}")
162
162
  end
163
163
 
164
+
165
+ # This method overrides the to_sym method to return the downcased symbolized
166
+ # system label value. This method is particularly useful in conjunction with
167
+ # role-based authorization systems.
168
+ #
169
+ def to_sym
170
+ self.send("#{acts_as_label_system_label_column}").downcase.to_sym
171
+ end
172
+
164
173
  end
165
174
 
166
175
  end
@@ -283,6 +283,10 @@ class ActsAsLabelTest < ActiveSupport::TestCase
283
283
  assert_equal role.label, role.to_s
284
284
  end
285
285
 
286
+ def test_to_sym
287
+ role = Role.first
288
+ assert_equal role.system_label.downcase.to_sym, role.to_sym
289
+ end
286
290
 
287
291
  def test_upcase_system_label_value
288
292
  record = Role.create!({ :system_label => "Customer", :label => "Client" })
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 5
9
- version: 0.1.5
8
+ - 6
9
+ version: 0.1.6
10
10
  platform: ruby
11
11
  authors:
12
12
  - Coroutine
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-03-25 00:00:00 -05:00
18
+ date: 2010-07-04 00:00:00 -05:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency