has_enum 0.9.0 → 0.9.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/has_enum/class_methods.rb +1 -1
- data/lib/has_enum/version.rb +1 -1
- data/spec/has_enum_spec.rb +5 -0
- metadata +3 -3
@@ -82,7 +82,7 @@ module HasEnum::ClassMethods
|
|
82
82
|
|
83
83
|
if options[:multiple]
|
84
84
|
define_method "#{attribute}=" do | values |
|
85
|
-
self[attribute] = [*values].compact.delete_if{|v| v.blank?}
|
85
|
+
self[attribute] = [*values].compact.map(&:to_s).delete_if{|v| v.blank?}
|
86
86
|
end
|
87
87
|
else
|
88
88
|
define_method "#{attribute}=" do | value |
|
data/lib/has_enum/version.rb
CHANGED
data/spec/has_enum_spec.rb
CHANGED
@@ -238,5 +238,10 @@ describe HasEnum do
|
|
238
238
|
model.speed = [:normal, :fast]
|
239
239
|
model.human_speed.should eql %w[Нормальный Быстрый]
|
240
240
|
end
|
241
|
+
|
242
|
+
it "should return array of string values for speed, even if initialized by symbols" do
|
243
|
+
model.speed = [:normal, :fast]
|
244
|
+
model.speed.should eql %w[normal fast]
|
245
|
+
end
|
241
246
|
end
|
242
247
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 9
|
8
|
-
-
|
9
|
-
version: 0.9.
|
8
|
+
- 1
|
9
|
+
version: 0.9.1
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Andreas Korth
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2011-04-
|
19
|
+
date: 2011-04-20 00:00:00 +07:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|