mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Fixed XHR typo and another Application => ApplicationController typo
This commit is contained in:
parent
67317b6104
commit
c2917940f5
1 changed files with 2 additions and 2 deletions
|
@ -375,7 +375,7 @@ The method simply stores an error message in the flash and redirects to the logi
|
||||||
In this example the filter is added to +ApplicationController+ and thus all controllers in the application inherit it. This will make everything in the application require the user to be logged in in order to use it. For obvious reasons (the user wouldn't be able to log in in the first place!), not all controllers or actions should require this. You can prevent this filter from running before particular actions with +skip_before_filter+:
|
In this example the filter is added to +ApplicationController+ and thus all controllers in the application inherit it. This will make everything in the application require the user to be logged in in order to use it. For obvious reasons (the user wouldn't be able to log in in the first place!), not all controllers or actions should require this. You can prevent this filter from running before particular actions with +skip_before_filter+:
|
||||||
|
|
||||||
<ruby>
|
<ruby>
|
||||||
class LoginsController < Application
|
class LoginsController < ApplicationController
|
||||||
skip_before_filter :require_login, :only => [:new, :create]
|
skip_before_filter :require_login, :only => [:new, :create]
|
||||||
end
|
end
|
||||||
</ruby>
|
</ruby>
|
||||||
|
@ -444,7 +444,7 @@ The Rails API documentation has "more information on using filters":http://api.r
|
||||||
|
|
||||||
h3. Verification
|
h3. Verification
|
||||||
|
|
||||||
Verifications make sure certain criteria are met in order for a controller or action to run. They can specify that a certain key (or several keys in the form of an array) is present in the +params+, +session+ or +flash+ hashes or that a certain HTTP method was used or that the request was made using +XMLHTTPRequest+ (Ajax). The default action taken when these criteria are not met is to render a 400 Bad Request response, but you can customize this by specifying a redirect URL or rendering something else and you can also add flash messages and HTTP headers to the response. It is described in the "API documentation":http://api.rubyonrails.org/classes/ActionController/Verification/ClassMethods.html as "essentially a special kind of before_filter".
|
Verifications make sure certain criteria are met in order for a controller or action to run. They can specify that a certain key (or several keys in the form of an array) is present in the +params+, +session+ or +flash+ hashes or that a certain HTTP method was used or that the request was made using +XMLHttpRequest+ (Ajax). The default action taken when these criteria are not met is to render a 400 Bad Request response, but you can customize this by specifying a redirect URL or rendering something else and you can also add flash messages and HTTP headers to the response. It is described in the "API documentation":http://api.rubyonrails.org/classes/ActionController/Verification/ClassMethods.html as "essentially a special kind of before_filter".
|
||||||
|
|
||||||
Here's an example of using verification to make sure the user supplies a username and a password in order to log in:
|
Here's an example of using verification to make sure the user supplies a username and a password in order to log in:
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue