GitHub Sale: sign up for any paid plan this week and pay nothing until January 1, 2009!  [ hide ]

public
Fork of lifo/doc-rails
Description: Repository for improving Rails documentation
Homepage: http://www.rubyonrails.org
Clone URL: git://github.com/zmalltalker/doc-rails.git
in rescue_from docs: fixed example code indentation for rdoc, and revised 
markup
Xavier Noria (author)
Tue Apr 08 02:49:04 -0700 2008
commit  b13829ba19699ae8eb8c1ad46077c14f47aa78c7
tree    8f5770c768c010481e7b00c154ad6531cd043629
parent  2faa4019a523bc57f48c37c6c9daab09df37dbb1
...
58
59
60
61
62
 
 
 
63
64
65
66
67
68
69
 
 
70
71
72
73
74
75
76
77
78
79
80
81
 
 
 
 
 
 
82
83
84
85
86
87
 
 
 
 
 
 
 
 
 
 
88
89
90
...
58
59
60
 
 
61
62
63
64
65
66
67
68
69
 
70
71
72
 
 
 
 
 
 
 
 
 
 
 
73
74
75
76
77
78
79
 
 
 
 
 
80
81
82
83
84
85
86
87
88
89
90
91
92
0
@@ -58,33 +58,35 @@ module ActionController #:nodoc:
0
       # Rescue exceptions raised in controller actions.
0
       #
0
       # <tt>rescue_from</tt> receives a series of exception classes or class
0
- # names, and a trailing :with option with the name of a method or a Proc
0
- # object to be called to handle them. Alternatively a block can be given.
0
+ # names, and a trailing <tt>:with</tt> option with the name of a method
0
+ # or a Proc object to be called to handle them. Alternatively a block can
0
+ # be given.
0
       #
0
       # Handlers that take one argument will be called with the exception, so
0
       # that the exception can be inspected when dealing with it.
0
       #
0
       # Handlers are inherited. They are searched from right to left, from
0
       # bottom to top, and up the hierarchy. The handler of the first class for
0
- # which exception.is_a?(klass) holds true is the one invoked, if any.
0
+ # which <tt>exception.is_a?(klass)</tt> holds true is the one invoked, if
0
+ # any.
0
       #
0
- # class ApplicationController < ActionController::Base
0
- # rescue_from User::NotAuthorized, :with => :deny_access # self defined exception
0
- # rescue_from ActiveRecord::RecordInvalid, :with => :show_errors
0
- #
0
- # rescue_from 'MyAppError::Base' do |exception|
0
- # render :xml => exception, :status => 500
0
- # end
0
- #
0
- # protected
0
- # def deny_access
0
- # ...
0
+ # class ApplicationController < ActionController::Base
0
+ # rescue_from User::NotAuthorized, :with => :deny_access # self defined exception
0
+ # rescue_from ActiveRecord::RecordInvalid, :with => :show_errors
0
+ #
0
+ # rescue_from 'MyAppError::Base' do |exception|
0
+ # render :xml => exception, :status => 500
0
       # end
0
- #
0
- # def show_errors(exception)
0
- # exception.record.new_record? ? ...
0
- # end
0
- # end
0
+ #
0
+ # protected
0
+ # def deny_access
0
+ # ...
0
+ # end
0
+ #
0
+ # def show_errors(exception)
0
+ # exception.record.new_record? ? ...
0
+ # end
0
+ # end
0
       def rescue_from(*klasses, &block)
0
         options = klasses.extract_options!
0
         unless options.has_key?(:with)

Comments

    No one has commented yet.