17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/enum_help/simple_form.rb', line 17
def initialize(*args)
super
enum = input_options[:collection] || @builder.options[:collection]
raise "Attribute '#{attribute_name}' has no enum class" unless enum ||= object.class.send(attribute_name.to_s.pluralize)
collect = enum.collect{|k,v| [::I18n.t("enums.#{object.class.to_s.underscore}.#{attribute_name}.#{k}", default: k),k] }
if respond_to?(:input_options)
input_options[:collection] = collect
else
@builder.options[:collection] = collect
end
end
|