I've extended the Form Helper module into a class. However, I received the undefined dom_class method
error. So I solved that by including the module instead. This fixed the dom_class
error but now I receive the error undefined form_for error
. How do I fix this and be able to use form_for
in my class?
class Form
extend ActionView::Helpers::RawOutputHelper
extend ActionView::Helpers::TagHelper
extend ActionView::Helpers::FormHelper
def self.generate
form_for([@projectdoc], :html => { :multipart => true, :remote => true, :controller => "projectdocs", :action=> 'item_create', :id => 'file-dropzone', :class => 'dropzone',:method => 'post'}) do |form|
form.file_field(:doc, :style => "visibility: hidden; position: absolute; top: 0px; left: 0px; height: 0px; width: 0px;")
end.html_safe
end
end
Aucun commentaire:
Enregistrer un commentaire