I am following the “Agile Web Development 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:
<h1>New Products on Display</h1>
<% for product in @products -%>
<%= image_tag @product.photo.url ( :small) %>
<---- (error here)
<h3><%=h product.title %></h3>
<%= product.description %>
<span class="price"><%= number_to_currency(product.price) %></span>
<%= button_to "Add to Cart" %>
<% end %>
This is my first post: Let me know if you guys need more information.
Thanks for the help.