justinfrench/formtastic — Issue #718: Integration with enumerated_attributes gem
Author: link-er
Created: 2011-10-14 18:24:21+00:00
State: open

I used enumerated_attribute with formtastic ~> 1.2.3 with "monkey patch" for field :as => :enum and everything worked fine.

But when I updated formtastic to 2.0.2 version appeared an error with message "Formtastic::UnknownInputError".

For more details here is patch, that was added to /initialisers/formtastic.rb:

module Formtastic #:nodoc:
class SemanticFormBuilder #:nodoc:
def enum_input(method, options)
unless options[:collection]
enum = @object.enums(method.to_sym)
choices = enum ? enum.select_options : []
options[:collection] = choices
end
if (value = @object.__send__(method.to_sym))
options[:selected] ||= value.to_s
else
options[:include_blank] ||= true
end
select_input(method, options)
end
end
end

P.S. I tried to change SemanticFormBuilder to FormBuilder (as I understood from new formtastic documentation there was such change for all custom inputs), but I was still getting error