slindsey3000
2010-Aug-12 01:04 UTC
ActiveRecord errors ... Best way to rescue a live web application?
Hi all, I have some issues when a link is clicked twice quickly that deletes an ActiveRecord row. All I really want to do is set up some universal catch that will redirect all application errors to index. Best way? Thanks! Shawn -- 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.
Bituin Bautista
2010-Aug-12 02:22 UTC
Re: ActiveRecord errors ... Best way to rescue a live web application?
try this: instead of ActiveRecord::Errors use ActiveRecord::ActiveRecordError, class ApplicationController < ActionController::Base rescue_from ActiveRecord::ActiveRecordError, :with => :method_name private def method_name redirect_to your_path end end ----- Original Message ----- From: "slindsey3000" <slindsey3000-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> To: "Ruby on Rails: Talk" <rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> Sent: Thursday, August 12, 2010 10:34 AM Subject: [Rails] ActiveRecord errors ... Best way to rescue a live web application?> Hi all, > > I have some issues when a link is clicked twice quickly that deletes > an ActiveRecord row. > > All I really want to do is set up some universal catch that will > redirect all application errors to index. > > Best way? > > Thanks! > > Shawn > > -- > 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. > >-- 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.
Fernando Perez
2010-Aug-12 12:08 UTC
Re: ActiveRecord errors ... Best way to rescue a live web application?
in your ApplicationController, define: def rescue_action(exception) super # optional # your code end -- 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.
Marnen Laibow-Koser
2010-Aug-12 14:24 UTC
Re: ActiveRecord errors ... Best way to rescue a live web application?
slindsey3000 wrote:> Hi all, > > I have some issues when a link is clicked twice quickly that deletes > an ActiveRecord row. > > All I really want to do is set up some universal catch that will > redirect all application errors to index. > > Best way?Put a redirect tag in 404.html or 500.html, perhaps.> > Thanks! > > ShawnBest, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org Sent from my iPhone -- 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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Bill Walton
2010-Aug-12 15:20 UTC
Re: Re: ActiveRecord errors ... Best way to rescue a live web application?
On Thu, Aug 12, 2010 at 9:24 AM, Marnen Laibow-Koser <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> slindsey3000 wrote: >> Hi all, >> >> I have some issues when a link is clicked twice quickly that deletes >> an ActiveRecord row. >> >> All I really want to do is set up some universal catch that will >> redirect all application errors to index. >> >> Best way? > > Put a redirect tag in 404.html or 500.html, perhaps.You can overwrite method_missing. HTH, Bill -- 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.
slindsey3000
2010-Aug-16 00:52 UTC
Re: ActiveRecord errors ... Best way to rescue a live web application?
@ Bituin Bautista Thank you works great. On Aug 11, 7:22 pm, "Bituin Bautista" <bituinbauti...-sFbbPxZDHXw0n/F98K4Iww@public.gmane.org> wrote:> try this: > instead of ActiveRecord::Errors use ActiveRecord::ActiveRecordError, > > class ApplicationController < ActionController::Base > > rescue_from ActiveRecord::ActiveRecordError, :with => :method_name > > private > > def method_name > redirect_to your_path > end > > end > > ----- Original Message ----- > From: "slindsey3000" <slindsey3...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > To: "Ruby on Rails: Talk" <rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > Sent: Thursday, August 12, 2010 10:34 AM > Subject: [Rails] ActiveRecord errors ... Best way to rescue a live web > application? > > > Hi all, > > > I have some issues when a link is clicked twice quickly that deletes > > an ActiveRecord row. > > > All I really want to do is set up some universal catch that will > > redirect all application errors to index. > > > Best way? > > > Thanks! > > > Shawn > > > -- > > 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.-- 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.