I setup an application in rails while performing some action am getting below error Status: 500 Internal Server Error Content-Type: text/html 500 Internal Server Error page. using Rails 2.2.2 I want to redirect the user to /500.html so that they get the error page that looks like our application,.how could achieve this ?? -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Jeremy Woertink
2010-Dec-02 23:04 UTC
Re: how to redirect to ERROR page /500.html in rails
I don''t remember how the rendering was in Rails 2.2.2, but this is how I''m doing it in my Rails 2.3.5+ apps render :file => File.join(Rails.root, ''public'', ''500.html'' You might need :layout => false ~Jeremy -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Jeremy Woertink wrote in post #965835:> I don''t remember how the rendering was in Rails 2.2.2, but this is how > I''m doing it in my Rails 2.3.5+ apps > > render :file => File.join(Rails.root, ''public'', ''500.html'' > > You might need :layout => false > > > ~JeremyThanks for ur response Jeremy .. am running my application in development mode but soon i switch to production mode i got what i required without any change ... means my application able to redirect to error page(500.html) as soon as switch to production mode... -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Also, don''t forget to pass the HTTP status code: render :status=> 500, :file => File.join(..... BUT! Rails will render 500 error page for you, but only on the remote server, in the rails sources there is a check if you send a request from the local pc, it renders trace code to you, and if you make request from remote PC it will render public/500.html page for you, without any customizations. On Dec 3, 2:56 pm, Amit Tomar <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Jeremy Woertink wrote in post #965835: > > > I don''t remember how the rendering was in Rails 2.2.2, but this is how > > I''m doing it in my Rails 2.3.5+ apps > > > render :file => File.join(Rails.root, ''public'', ''500.html'' > > > You might need :layout => false > > > ~Jeremy > > Thanks for ur response Jeremy .. > > am running my application in development mode but soon i switch to > production mode i got what i required without any change ... > > means my application able to redirect to error page(500.html) as soon as > switch to production mode... > > -- > Posted viahttp://www.ruby-forum.com/.-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
yurokle wrote in post #966008:> Also, don''t forget to pass the HTTP status code: > render :status=> 500, :file => File.join(..... > > BUT! Rails will render 500 error page for you, but only on the remote > server, > in the rails sources there is a check if you send a request from the > local pc, it renders trace code to you, > and if you make request from remote PC it will render public/500.html > page for you, without any customizations.Means it has nothing to do with production mode or development mode ?? -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.