how to render 404 instead NoMethodError in People#show error
the code
def show
  @person = Person.find(params[:id])
   respond_to do |format|
    format.html # show.html.erb
    format.xml  { render :xml => @person }
  end
end
how to render 404 instead NoMethodError in People#show error
the code
def show
  @person = Person.find(params[:id])
   respond_to do |format|
    format.html # show.html.erb
    format.xml  { render :xml => @person }
  end
end
 
    
    NoMethodError will render a 500 in production mode, however if you want to also render a 404 status in the headers in development mode, you can do the following:
 redirect_to :status => 404
To render the standard 404 page, you can check out the top answer here.
 
    
    