Beginner Error: You have a nil object

So I set out to build an app that is very similar to the Depot app to
build my experience. I added a lot of constant lists for the
pulldowns on the admin add product page. Then this error?

NoMethodError in Admin#new

Showing app/views/admin/_form.rhtml where line #9 raised:

You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.select

Extracted source (around line #9):

6:
7: <p><label for="vehicle_newused">Newused</label><br/>
8: <%=
9: form.select :newused,
10: Vehicle::NEWUSED,
11: :prompt => "New or used vehicle?"
12: %></p>

from vehicle.rb

  NEWUSED = [
    ["New", "New"],
    ["Used", "Used"]
  ]

The error is related to the 'form' variable being nil, not your
NEWUSED constant. So start looking there. Where is form defined?

I don't, I thought it was universal: form.select and form.text_field
and form.text_area. Hrm. I'm assuming that I missed one of these
guys:
<div class="fss-form">

You just added a div field, which certainly doesn't do anything as far
as Ruby is concerned.

You're probably missing something like

<% form_for :something, :url => some_url, do |form| %>

Take a closer look at whatever code you're copying. It'll show you
exactly what you need to do.

Pat

Ok, you are correct. I found out the problem but that led to another
problem. I'm converted a dynamic scaffold to a static and then edited
the rhtml so that all of the fields wouldn't be textboxes. In this
case I want a select pulldown and have two options to choose from. I
just removed the form. on each one and now I've got a page with the
pulldowns with one option: prompt.

Ok, I'm getting closer. This gives me the pull-down with NewNew in it
-- I need it to be New or Used and not printed twice.

<p><label for="vehicle_newused">Newused</label><br/>
<%=
  select 'vehicle_newused','newused',
  [Vehicle::NEWUSED]
   %></p>

This appears to be the answer, thanks to AgileROR:
<p><label for="vehicle_newused">Newused</label><br/>
<%=
  select (:vehicle, :newused, Vehicle::NEWUSED, :prompt => "New or
used?")
   %></p>