We using the following code to pass a formbuilder to a render partial in new.js.erb:
<% @f = ActionView::Helpers::FormBuilder.new(:expense, @expense, self, {}, proc {} ) %>
var rpt = $("<%= escape_javascript(render 'expenses/expense_for', :f => @f) %>");
The @f is the formbuilder generated for the partial. The error is:
ActionView::Template::Error (undefined method `input' for #<ActionView::Helpers::FormBuilder:0x60c6828>):
1: <%= f.input :expense_for, :label => "栏目: ", :collection => @expense_for %>
The partial _expense_for.html.erb is:
<%= f.input :expense_for, :label => "栏目: ", :collection => @expense_for %>
As the error shows, the input method was not defined for f formbuilder in partial above. What could be wrong with the formbuilder passed in? Thanks.
The error says that ActionView::Helpers::FormBuilder
has no method input. That's true as far as I know. input
is a SimpleForm or Formtastic method, try with f.select
(you'll need to change the arguments).