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 -%>
<div class="entry">
<%= image_tag @product.photo.url ( :small) %>
<---- (error here)
<h3><%=h product.title %></h3>
<%= product.description %>
<div class="price-line">
<span class="price"><%= number_to_currency(product.price) %></span>
<%= button_to "Add to Cart" %>
</div>
</div>
<% end %>
This is my first post: Let me know if you guys need more information.
Thanks for the help.
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---