objectreload-simple_enumerations 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
data/VERSION.yml
CHANGED
@@ -2,7 +2,7 @@ module Wijet
|
|
2
2
|
module FormHelper
|
3
3
|
def select_enumeration(method)
|
4
4
|
@template.select_tag "#{@object_name}[#{method}]",
|
5
|
-
@template.options_from_collection_for_select(
|
5
|
+
@template.options_from_collection_for_select(Enumeration[method], :to_s, :to_s , @object.send(method).to_s)
|
6
6
|
end
|
7
7
|
end
|
8
8
|
end
|
@@ -6,20 +6,20 @@ module Wijet
|
|
6
6
|
|
7
7
|
module ClassMethods
|
8
8
|
def has_enumerated(name)
|
9
|
-
|
9
|
+
Enumeration.setup
|
10
10
|
|
11
11
|
name = name.to_s
|
12
12
|
|
13
13
|
define_method("#{name}=") do |value|
|
14
14
|
value = value.to_s
|
15
|
-
unless
|
15
|
+
unless Enumeration[name].include?(value) or value.blank?
|
16
16
|
raise ArgumentError, "'#{value}' is not a value of enumeration '#{name}'"
|
17
17
|
end
|
18
18
|
write_attribute(name, value)
|
19
19
|
end
|
20
20
|
|
21
21
|
define_method(name) do
|
22
|
-
|
22
|
+
Enumeration.new(attributes[name])
|
23
23
|
end
|
24
24
|
end
|
25
25
|
end
|
@@ -56,3 +56,5 @@ module Wijet
|
|
56
56
|
end
|
57
57
|
end
|
58
58
|
end
|
59
|
+
|
60
|
+
include Wijet::SimpleEnumerations::EnumerationString
|
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{objectreload-simple_enumerations}
|
8
|
-
s.version = "0.1.
|
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 = ["Mariusz Pietrzyk", "Mateusz Drozdzynski"]
|