On Oct 4, 8:50 pm, Craig White <[email protected]> wrote:
> I am having problems with rescue actions. Currently using 'development'
> and it is sending e-mails no problem but it still drives me to the error
> page...
>
> My specific error at this point is
> ActionController::InvalidAuthenticityToken
> and I am using an expired session to generate the errors.
>
Your if statement is bogus, you're just comparing an exception object
with a string. Try using is_a? to see if the exception object is an
instance of a given exception class. See also rescue_from
Fred
Fred
> in application.rb I have...
>
> # this part doesn't seem to work
> def rescue_action_in_public(exception)
> if exception == "ActionController::InvalidAuthenticityToken"
> flash[:notice]="Your session expired"
> redirect_to :controller => 'login', :action => 'login'
> else
> flash[:notice]="The Application Server dumped"
> request.env["HTTP_REFERER"]
> redirect_to :back
> end
> end
>
> # this part works...I get the e-mails
> protected
>
> # Provides code to create an email generated upon error
> def log_error(exception)
> super(exception)
> begin
> ErrorMailer.deliver_snapshot(
> exception,
> clean_backtrace(exception),
> session.instance_variable_get("@data"),
> params,
> request.env)
> rescue => e
> logger.error(e)
> end
> end
>
> Craig
>
> --
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is
> believed to be clean.
--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---