timcharper / calendar_date_select

A previously popular but no longer maintained JavaScript DatePicker for RubyOnRails (and others)
http://code.google.com/p/calendardateselect/
Other
409 stars 179 forks source link

Problem with nested form fields #1

Closed kamk closed 13 years ago

kamk commented 15 years ago

To reproduce:

<% form_for :user do |user_form|
      user_form.fields_for :user_dates do |dates_form| %>
  <%= dates_form.calendar_date_select :first_date %>
<% end %>
kamk commented 15 years ago

Just forgot one more closing <% end %> but it gives me error '@user[user_dates]' is not allowed as an instance variable name

jnimety commented 15 years ago

just ran into the same issue after changing a relationship from has_many to has_one, I had

<% f.fields_for :scheduled_jobs do |sj_form| %>
  <%= sj_form.calendar_date_select :start_date %>
<% end %>

Turns out I forgot to update the fields_for, :scheduled_jobs should have been :scheduled_job. This resolved the issue for me.