Newbie Help (No Method Error)

I am following the “Agile Web D. with Rails” and I have decided
to deviate from the book a bit to discover Rails plugins.

I have set up my app to use “paperclip” to size my photos. I have
managed to get the app working on part of my application.

But…Im getting this error.

NoMethodError in Store#index
You have a nil object when you didn’t expect it!
The error occurred while evaluating nil.photo

Extracted source (around line #5):

This is my code:

New Products on Display

<% for product in @products -%>

<%= image_tag @product.photo.url ( :small) %>

<---- (error here)

<%=h product.title %>

<%= product.description %>

<div class="price-line">

<span class="price"><%= number_to_currency(product.price) %></span>

<%= button_to "Add to Cart" %>

</div>

<% end %>

This is my first post: Let me know if you guys need more information.
Thanks for the help.

On May 28, 2009, at 11:45 AM, Michael Michael wrote:

NoMethodError in Store#index

<% for product in @products -%>

<%= image_tag @product.photo.url ( :small) %>

@product should be product without the @.

Perfect… It works now!

Thank you for helping me out Philip