Method not found > Error page

Hey,
I was wondering. If someone travels to a url ie.
app.com/controller/method

and method does not exist. How do i present them with a page not found
error instead of getting Rails method not found errors?

thanks,
bp

brianp wrote:

Hey,
I was wondering. If someone travels to a url ie.
app.com/controller/method

and method does not exist. How do i present them with a page not found
error instead of getting Rails method not found errors?

thanks,
bp

Brian

visit http://www.classifiedscript.in and download railslist. It
drastically increases your learning speed. for your specific question,
look into application controller. For a better understanding go to
Ryan’s railscasts. They are superb.

in your application controller you can use

def rescue_with_handler(exception)
render :file => “#{RAILS_ROOT}/public/404.html”
end

Read about routes. I’m not an expert but I remember reading about
being able to set a default ‘catch all’ to redirect wherever you want.

Pepe

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs