Render_404 and return not working but it works if I split it in two lines

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.
*

On Nov 29, 2007 9:28 AM, Neeraj K. [email protected] wrote:

@vendor = Vendor.find(:first, :conditions => {:status => 1, :id =>
params[:id]})

@vendor = Vendor.find( :first, :conditions => [ ‘status = 1 AND id =
?’, params[:id] ] )


Greg D.
http://destiney.com/

I know I should sanitize the user input.