11175
(-- --)
1
I have a partial that has the following code:
<% if product.prd_big_image.nil? %>
<img alt="Image" src="/images/empty.jpg">
<% else %>
<%= image_tag url_for_file_column(:product, :prd_big_image,
"normal") %>
<% end %>
and get the following error
You have a nil object when you didn't expect it!
The error occurred while evaluating nil.prd_big_image_relative_path
If I run the code in a normal html.erb (not a partial) it works fine,
just has issues within the partial
any ideas?
Michael Moulsdale wrote:
I have a partial that has the following code:
<% if product.prd_big_image.nil? %>
<img alt="Image" src="/images/empty.jpg">
<% else %>
<%= image_tag url_for_file_column(:product, :prd_big_image,
"normal") %>
<% end %>
and get the following error
You have a nil object when you didn't expect it!
The error occurred while evaluating nil.prd_big_image_relative_path
If I run the code in a normal html.erb (not a partial) it works fine,
just has issues within the partial
any ideas?
You need to assign @product = product somewhere in the partial.