haz_enum 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/haz_enum.gemspec +2 -2
- data/lib/haz_enum/enum.rb +1 -1
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.5.
|
1
|
+
0.5.1
|
data/haz_enum.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{haz_enum}
|
8
|
-
s.version = "0.5.
|
8
|
+
s.version = "0.5.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["thyphoon"]
|
12
|
-
s.date = %q{
|
12
|
+
s.date = %q{2011-03-20}
|
13
13
|
s.description = %q{use has_set and has_enum in your ActiveRecord models if you want to have one (has_enum) value from a defined enumeration or more (has_set))}
|
14
14
|
s.email = %q{andi@galaxycats.com}
|
15
15
|
s.extra_rdoc_files = [
|
data/lib/haz_enum/enum.rb
CHANGED
@@ -3,7 +3,7 @@ module HazEnum
|
|
3
3
|
def has_enum(enum_name, options={})
|
4
4
|
enum_name = enum_name.to_s
|
5
5
|
enum_column = options.has_key?(:column_name) ? options[:column_name].to_s : enum_name
|
6
|
-
enum_class = options.has_key?(:class_name) ?
|
6
|
+
enum_class = options.has_key?(:class_name) ? options[:class_name].constantize : enum_name.pluralize.camelize.constantize
|
7
7
|
|
8
8
|
self.attr_protected("#{enum_column}") if enum_name != enum_column
|
9
9
|
self.validate "#{enum_column}_check_for_valid_enum_value"
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 5
|
8
|
-
-
|
9
|
-
version: 0.5.
|
8
|
+
- 1
|
9
|
+
version: 0.5.1
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- thyphoon
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date:
|
17
|
+
date: 2011-03-20 00:00:00 +01:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|