I had a piece of code in an rjs file that checked to see if a variable
existed:
if @product
… do something here …
end
that worked fine, but then I also need to check and see if a column is
empty or nil, so i changed it to this:
if @product || !@product.price.blank?
… do something here …
end
this always gives me “You have a nil object when you didn’t expect
it!” errors
is there a better way of doing this without nesting if statements
inside eachother?