Custom form builder


I am trying to create a custom form builder but got the following error: wrong argument type Class (expected Module)

To create a form builder I have to subclass ActionView::Helpers::FormBuilder. So, I guess, it must be a class and not a module or maybe a class wrapped inside a module…

Here is the idea:

The helper (/app/helpers/custom_form_helper.rb):

class CustomFormHelper < ActionView::Helpers::FormBuilder

def datalist_for(method, choices, options = {})
 ...     # I'd like to render a partial here with :locals => {:list => choices, :name => @object_name + "[_#{method}]"}



The partial (app/view/shared):

<input type=“text” name=<%= name %> list=“list”>

<% choices.each do |elem| %>

    <option value=<%= elem %> >
<% end %>

The view:

<%= form_for(:moove, :builder => “CustomFormHelper” :url => {:action => ‘create’}) do |f| %>

        <td><%= f.datalist_for(:sport, @sports)%></td>

<% end %>

Thank you in advance for your help,