bcardarella/client_side_validations — Issue #262: Error: "can't convert nil into Hash" for muliple record updates
Author: wherebear
Created: 2012-01-26 21:13:29+00:00
State: open

I have an error that arises when this gem is installed on the form below:

Error:
TypeError in Hours#edit

can't convert nil into Hash

Extracted source (around line #6):

3: <%= form_for :hour, :url => {:action => 'update'}, :validate => false, :method => :put do -%>
4:	<% @hours.each do |hour| %>
5:

6:

<%= day_to_text(hour.day) %>: <%= hour_to_time(hour.open) %> to <%= hour_to_time(hour.close) %>

7:	<%= fields_for "hours[]", hour do |f| %>
8:	<%= render 'shared/error_messages', :object => f.object %>
9:	<%= f.hidden_field :open, :id => "open_range_"+hour.day.to_s %>

It has to do with the "fields_for" block and the way it is structured. This is the way that a railscast tutorial demonstrated for multiple record updating, and it works perfectly until I installed this gem. I really want to use this gem for validating other forms, I don't want to validate this form with it, which is why I put false in the form but it still gives me the error.

I have tried just about everything, any help would be greatly appreciated.

Thanks,
Louis