1

Would it be a good idea to add an standard internal 404 page (not in public but in app/view/shared/ folder). A page where user can move to other existing pages via menu / links etc.

Many good websites allow user to browse their site menu on 404. i.e. If in you login into facebook and click some 404 facebook page. YOu will see feeds chats with 404.

Well, In rails I don't know How to do this. well, I google-ed on it.

and What I found (Should be done to handle 404):

render :file => "#{Rails.root}/public/404.html", :status => 404, :layout => false

What I currently have :

render :text => 'User not found', :status => 404`

What I want to do : (if its not bad solution of handling 404):

render :file => '/view/shared/404.html.erb', :status => 404

Please suggest!

Manish Shrivastava
  • 30,617
  • 13
  • 97
  • 101
  • Why don't you just write a controller with corresponding view files, etc.? As also mentioned [here](http://stackoverflow.com/a/19279062/2295964)? – Yan Foto Apr 23 '14 at 11:53

1 Answers1

1

Try rendering like:

render "shared/404", :status => 404

I haven't tried it but from what's said in Two controllers for one shared view in Ruby on Rails answer, this might work.

Community
  • 1
  • 1
SreekanthGS
  • 988
  • 5
  • 12