Following code works
@vendor = Vendor.find(:first, :conditions => {:status => 1, :id =>
params[:id]})
unless @vendor
render_404
return
end
**
However this code fails.
*
@vendor = Vendor.find(:first, :conditions => {:status => 1, :id =>
params[:id]})
unless @vendor
render_404 and return
end
with following error message.
Called id for nil, which would mistakenly be 4 – if you really wanted
the
id of nil, use object_id
I have seen people use do something and return. Why my code is failing.
*