diff options
author | Pratik Naik <pratiknaik@gmail.com> | 2008-11-06 01:10:30 +0530 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2008-11-06 01:10:30 +0530 |
commit | 396d599e24cbfa15c62b20fab8cc02cdba046ce3 (patch) | |
tree | 11dd8368e2674342098af21136893bee491c44ff /railties/doc/guides/source/actioncontroller_basics/verification.txt | |
parent | 32089cbcc9ca3fb935f783e7a7ef2b60b7d43006 (diff) | |
download | rails-396d599e24cbfa15c62b20fab8cc02cdba046ce3.tar.gz rails-396d599e24cbfa15c62b20fab8cc02cdba046ce3.tar.bz2 rails-396d599e24cbfa15c62b20fab8cc02cdba046ce3.zip |
Update guides from docrails
Diffstat (limited to 'railties/doc/guides/source/actioncontroller_basics/verification.txt')
-rw-r--r-- | railties/doc/guides/source/actioncontroller_basics/verification.txt | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/railties/doc/guides/source/actioncontroller_basics/verification.txt b/railties/doc/guides/source/actioncontroller_basics/verification.txt index 39046eee85..5d8ee6117e 100644 --- a/railties/doc/guides/source/actioncontroller_basics/verification.txt +++ b/railties/doc/guides/source/actioncontroller_basics/verification.txt @@ -1,8 +1,8 @@ == Verification == -Verifications make sure certain criterias 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 criterias 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 link:http://api.rubyonrails.org/classes/ActionController/Verification/ClassMethods.html[API codumentation] 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 link:http://api.rubyonrails.org/classes/ActionController/Verification/ClassMethods.html[API documentation] as "essentially a special kind of before_filter". -Let's see how we can use 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: [source, ruby] --------------------------------------- @@ -34,7 +34,7 @@ class LoginsController < ApplicationController verify :params => [:username, :password], :render => {:action => "new"}, :add_flash => {:error => "Username and password required to log in"}, - :only => :create #Only run this verification for the "create" action + :only => :create # Only run this verification for the "create" action end --------------------------------------- |