mike343
#1
I have a partial that has the following code:
<% if product.prd_big_image.nil? %>

<% 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?
mike343
#2
Michael Moulsdale wrote:
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.
–
Rails Wheels - Find Plugins, List & Sell Plugins -
http://railswheels.com