I’m trying to create a data entry form but getting an error when it
sumbmits. I am using an hash to get the names of the fields definied
in the controller’s “new” function:
@thing = thing.new
@columns = Hash.new
@columns['thing_general'] = [ ["title","name"], ["number","num"],
and then I access it in the object’s new.html.erb:
<% for c in @columns[‘thing_general’] do %>
<input id="<%=c.second%>" name="thing[<%=c.second
the first time I load the page, the correct form displays but then
when I click submit, I get this error :
You have a nil object when you didn’t expect it!
You might have expected an instance of ActiveRecord::Base.
The error occurred while evaluating nil.
Extracted source (around line #38):
38: <% for c in @columns[‘thing_general’] do %>
why would it get a nil object when I submit the form (after working
the first time) and why is it trying to load the same page after