Hi everyone, looking for some help with this error below. It seems
that althought it finds the product_line_id attribute, the code
doesn’t find the product_line’s name attribute. I’ve already declared
the has_many: call_driver relationship in the product_line model, and
the belongs_to: product_line relationship in the call_driver model.
It also works in the console, oddly enough, but not in the view.
I know I’m missing something elemental here, but I haven’t the
faintest clue what it is.
NoMethodError in Admin#index
Showing admin/index.html.erb where line #13 raised:
You have a nil object when you didn’t expect it!
The error occurred while evaluating nil.name
Extracted source (around line #13):
10: <% for driver in @driver %>
11:
12:
13:
14:
15: <%= link_to ‘Destroy’, {:action => ‘driver_delete’,:id =>
driver.id} %>
16:
admin_controller has this for the index action;
def index
@driver = CallDriver.find(:all)
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @driver }
end
end