Topic: Missing Input Box when using Scaffold

Has anyone had an issue with a missing input box when they're using the scaffold generator?

I tried deleting and recreating the database to no avail.

-xdotcommer

Re: Missing Input Box when using Scaffold

What do you mean by missing input box? Can you give a concrete example?

Railscasts - Free Ruby on Rails Screencasts

Re: Missing Input Box when using Scaffold

Sure.  The first field works fine, but the second field doesn't display when using the scaffold code:

<p><label for="journal_migraine_symptoms">Migraine symptoms</label><br/>
<input id="journal_migraine_symptoms" name="journal[migraine_symptoms]" size="30" type="text" /></p>

<p><label for="journal_migraine_time_to_relief">Migraine time to relief</label><br/>

</p>

That's a section of the HTML generated by the scaffold code:
<%= start_form_tag :action => 'create' %>
  <%= render :partial => 'form' %>
  <%= submit_tag "Create" %>
<%= end_form_tag %>

Re: Missing Input Box when using Scaffold

For some reason it didn't get updated in the _form partial:

<p><label for="journal_migraine_symptoms">Migraine symptoms</label><br/>
<%= text_field 'journal', 'migraine_symptoms'  %></p>

<p><label for="journal_migraine_time_to_relief">Migraine time to relief</label><br/>
</p>

I can fill it in myself, I'm just wondering if it's a bug.

Re: Missing Input Box when using Scaffold

I've never seen it add a label without adding a field too. It does sound like a bug. What type of column is migraine_time_to_relief in the database?

Railscasts - Free Ruby on Rails Screencasts

Re: Missing Input Box when using Scaffold

At first I made the data type "time" (I'm using rails migrations).

Then I changed it to "integer" and it still had a problem.

I may go back and try to reproduce the problem starting from scratch.

Re: Missing Input Box when using Scaffold

Thanks for your help, but I do have one more question regarding the << operator in this case.  Shouldn't that operator have made the row in the locations table with a null value for everything except the phone_id and user_id columns.  Even though the rest of the data is not there, I would still expect the join to get created.  Is there a way to use the << operator to create the associated rows?