Error when rendering a partial (RoR) passing the form as a local variable
Posted
by Dmitriy Likhten
on Stack Overflow
See other posts from Stack Overflow
or by Dmitriy Likhten
Published on 2010-03-19T06:56:38Z
Indexed on
2010/03/19
7:01 UTC
Read the original article
Hit count: 206
ruby-on-rails
In my main template I have the following:
<%= render :partial => "delivery_date", :collection => @brand.delivery_dates, :locals => {:form => f} %>
However when the partial tries to use the form local variable, I get this error
Showing app/views/brands/_delivery_date.html.erb where line #2 raised:
wrong number of arguments (0 for 1)
Extracted source (around line #2):
1: <%= delivery_date.id %>
2: <%= form.text_field :name %>
3: <% new_or_existing = delivery_date.new_record? ? 'new' : 'existing' %>
4: <% prefix = "brand[#{new_or_existing}_delivery_date_attributes][]" %>
5: <% fields_for prefix, delivery_date do |dd_f| %>
Does anyone understand what this error means?
Actually I want to do
<% form.fields_for delivery_date do |dd_f| %>
but that fails as well.
© Stack Overflow or respective owner