acts_as_enum 1.3.1 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/MIT-LICENSE +0 -0
- data/README.rdoc +2 -2
- data/Rakefile +0 -0
- data/TODO +0 -0
- data/VERSION +1 -1
- data/init.rb +0 -0
- data/lib/acts_as_enum.rb +6 -2
- data/lib/tasks/acts_as_enum_tasks.rake +0 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5fc3b3070cca09d3473828a02c8f632d33fec65a
|
4
|
+
data.tar.gz: 6c560f8fa20a1863ea9002785ea170ef1964c2b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 07a65f0581b46b0380a08fc0892d5222e16feb151bc3989179858e085b326c09f737e7dc823bb69fb6885067d05c67be7260c1380f5cb5e0dcead4e7d01f7f31
|
7
|
+
data.tar.gz: a5fb55a2785003f3daa46d4589cf54621be6ac26269f5b935b6cf185034df9b67f6db852e9d0269dafdc1b1f862624c609fac13502c24f8de8c84700a2652318
|
data/MIT-LICENSE
CHANGED
File without changes
|
data/README.rdoc
CHANGED
@@ -38,11 +38,11 @@ Table column type as String
|
|
38
38
|
Or
|
39
39
|
|
40
40
|
class User < ActiveRecord::Base
|
41
|
-
acts_as_enum :status, :in => { 'disable' => '冻结',
|
41
|
+
acts_as_enum :status, :in => { 'disable' => '冻结', 'enable' => '激活' }
|
42
42
|
end
|
43
43
|
|
44
44
|
class User < ActiveRecord::Base
|
45
|
-
enum_attr :status, :in => { 'disable' => '冻结',
|
45
|
+
enum_attr :status, :in => { 'disable' => '冻结', 'enable' => '激活' }
|
46
46
|
end
|
47
47
|
|
48
48
|
Table column type as Integer
|
data/Rakefile
CHANGED
File without changes
|
data/TODO
CHANGED
File without changes
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.4.0
|
data/init.rb
CHANGED
File without changes
|
data/lib/acts_as_enum.rb
CHANGED
@@ -15,7 +15,7 @@
|
|
15
15
|
# acts_as_enum :status, :in => [ ['disable', '冻结'], ['enable', '激活'] ]
|
16
16
|
# end
|
17
17
|
# class User < ActiveRecord::Base
|
18
|
-
# acts_as_enum :status, :in => { 'disable' => '冻结',
|
18
|
+
# acts_as_enum :status, :in => { 'disable' => '冻结', 'enable' => '激活' }
|
19
19
|
# end
|
20
20
|
#
|
21
21
|
# and type is Integer or number of string
|
@@ -69,7 +69,11 @@ module ActsAsEnum
|
|
69
69
|
end
|
70
70
|
|
71
71
|
attr_options = enum.each_with_object({}) do |arr, hash|
|
72
|
-
|
72
|
+
if arr.count == 2
|
73
|
+
hash[arr.last.to_s] = arr.last.to_s
|
74
|
+
else
|
75
|
+
hash[arr[-2]] = arr.last.to_s
|
76
|
+
end
|
73
77
|
end
|
74
78
|
const_set(plural_upcase_attr, attr_options)
|
75
79
|
|
File without changes
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: acts_as_enum
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Liang
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-04-01 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: For multiple values activerecord attributes. This gem have some very
|
14
14
|
useful methods and constants for attribute.
|
@@ -45,7 +45,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
45
45
|
version: 1.3.4
|
46
46
|
requirements: []
|
47
47
|
rubyforge_project: acts_as_enum
|
48
|
-
rubygems_version: 2.
|
48
|
+
rubygems_version: 2.4.3
|
49
49
|
signing_key:
|
50
50
|
specification_version: 4
|
51
51
|
summary: Enum Attribute for Rails ActiveRecord
|