enum_attr 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/enum_attr.gemspec +2 -2
- data/lib/enum_attr_for_active_record.rb +2 -1
- metadata +2 -2
data/enum_attr.gemspec
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
|
|
6
6
|
Gem::Specification.new do |s|
|
|
7
7
|
s.name = %q{enum_attr}
|
|
8
|
-
s.version = "1.0.
|
|
8
|
+
s.version = "1.0.2"
|
|
9
9
|
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
11
11
|
s.authors = ["qichunren"]
|
|
12
|
-
s.date = %q{2012-09-
|
|
12
|
+
s.date = %q{2012-09-17}
|
|
13
13
|
s.description = %q{A Rails plugin which brings easy-to-use enum-like functionality to ActiveRecord models (now compatible with rails 3, ruby 1.9 and jruby). .}
|
|
14
14
|
s.email = %q{whyruby@gmail.com}
|
|
15
15
|
s.extra_rdoc_files = [
|
|
@@ -12,8 +12,9 @@ module EnumAttr
|
|
|
12
12
|
scope "#{attr}_#{enum[2]}".to_sym, where("#{attr}=#{enum[1]}")
|
|
13
13
|
end # end: enums.each
|
|
14
14
|
|
|
15
|
+
validates_inclusion_of attr, :in => enums.map{|e| e[1] }, :allow_nil => true
|
|
16
|
+
|
|
15
17
|
self.class_eval(%Q{
|
|
16
|
-
validates_inclusion_of attr, :in => enums.map{|e| e[1].to_i}, :allow_nil => true
|
|
17
18
|
def attr
|
|
18
19
|
read_attribute(attr.to_sym)
|
|
19
20
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: enum_attr
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.2
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2012-09-
|
|
12
|
+
date: 2012-09-17 00:00:00.000000000 Z
|
|
13
13
|
dependencies: []
|
|
14
14
|
description: A Rails plugin which brings easy-to-use enum-like functionality to ActiveRecord
|
|
15
15
|
models (now compatible with rails 3, ruby 1.9 and jruby). .
|