# Newbie Help (No Method Error)

**URL:** <https://www.ruby-forum.com/t/newbie-help-no-method-error/169057>\
**Category:** Rails\
**Created:** [May 28, 2009, 8:45pm UTC](https://www.ruby-forum.com/t/newbie-help-no-method-error/169057 "2009-05-28T20:45:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mike343](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/58f4c7/32.png) [@mike343](https://www.ruby-forum.com/u/mike343)\
**Post date:** [May 28, 2009, 8:45pm UTC](https://www.ruby-forum.com/t/newbie-help-no-method-error/169057/1 "2009-05-28T20:45:55Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![mike343](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/58f4c7/32.png) [@mike343](https://www.ruby-forum.com/u/mike343)\
**Post date:** [May 28, 2009, 9:17pm UTC](https://www.ruby-forum.com/t/newbie-help-no-method-error/169057/2 "2009-05-28T21:17:43Z")

</div>

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 @.

---

<div class="post-metadata">

**Author:** ![mike343](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/58f4c7/32.png) [@mike343](https://www.ruby-forum.com/u/mike343)\
**Post date:** [May 28, 2009, 9:34pm UTC](https://www.ruby-forum.com/t/newbie-help-no-method-error/169057/3 "2009-05-28T21:34:24Z")

</div>

Perfect… It works now!

Thank you for helping me out Philip
