F IL TERS
AND
V ERIFICATION
This declaration applies the verification to the post_comment action. If the session does not contain the key :user_id, a note is added to the flash, and the request is redirected to the index action. The parameters to verify can be split into three categories.
Applicability These options select that actions have the verification applied: :only =>:name or [ :name, ... ]
Verifies only the listed action or actions. :except =>:name or [ :name, ... ]
Verifies all actions except those listed.
Tests These options describe the tests to be performed on the request. If more than one of these is given, all must be true for the verification to succeed. :flash =>:key or [ :key, ... ]
The flash must include the given key or keys. :method =>:symbol or [ :symbol, ... ]
The request method (:get, :post, :head, or :delete) must match one of the given symbols. :params =>:key or [ :key, ... ]
The request parameters must include the given key or keys. :session =>:key or [ :key, ... ]
The session must include the given key or keys. :xhr => true or false
The request must (must not) come from an Ajax call.
Actions These options describe what should happen if a verification fails. If no actions are specified, the verification returns an empty response to the browser on failure. :add_flash =>hash
Merges the given hash of key/value pairs into the flash. This can be used to generate error responses to users. :add_headers =>hash
Merges the given hash of key/value pairs into the response headers.
Report erratum
Prepared exclusively for Bill Trammel
this copy is (P1.0 printing, March 2009)
495