Generic-user-small Casey Smith 5 posts

I get an error when I run http://localhost:3000/login/login I get this error message=

NoMethodError in Login#index

Showing login/index.html.erb where line #3 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.each

Extracted source (around line #3):

1:

Your Pragmatic Catalog


2:
3: <% for product in @products ->
4:

5: <= image_tag(product.image_url) >
6:

<= h(product.title) %>

 
Samr_small_small Sam Ruby 109 posts

Um, you are ahead of me. Check the preface to the third edition for what chapters are ready. Either that, or look for the visual clues in the form of the colors of the top and bottom borders on each page.

 
Generic-user-small Casey Smith 5 posts

Thanks Sam I will check that. Is there a place just to get problems answers that I come across?

 
Samr_small_small Sam Ruby 109 posts

I’ll try to explore further tomorrow, but to get past that specific problem, modify app/controllers/login_controller.rb thus:

def index
  @products = Product.find(:all)
  @total_orders = Order.count
end
 
Samr_small_small Sam Ruby 109 posts

This will be corrected in the next beta, but click on the following for the correct version of app/views/login/index.rhtml

Sorry for the inconvenience.

5 posts, 2 voices