mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Added that all renders and redirects now return false, so they can be used as the last line in before_filters to stop execution.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@364 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
parent
e96c08b1aa
commit
576b162725
2 changed files with 17 additions and 0 deletions
|
@ -1,5 +1,20 @@
|
|||
*SVN*
|
||||
|
||||
* Added that all renders and redirects now return false, so they can be used as the last line in before_filters to stop execution.
|
||||
|
||||
Before:
|
||||
def authenticate
|
||||
unless @session[:authenticated]
|
||||
redirect_to :controller => "account", :action => "login"
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
After:
|
||||
def authenticate
|
||||
redirect_to(:controller => "account", :action => "login") unless @session[:authenticated]
|
||||
end
|
||||
|
||||
* Added conditional filters #431 [Marcel]. Example:
|
||||
|
||||
class JournalController < ActionController::Base
|
||||
|
|
|
@ -389,6 +389,7 @@ module ActionController #:nodoc:
|
|||
@response.headers["Status"] = status || DEFAULT_RENDER_STATUS_CODE
|
||||
@response.body = block_given? ? block : text
|
||||
@performed_render = true
|
||||
return false
|
||||
end
|
||||
|
||||
# Renders an empty response that can be used when the request is only interested in triggering an effect. Do note that good
|
||||
|
@ -543,6 +544,7 @@ module ActionController #:nodoc:
|
|||
logger.info("Redirected to #{url}") unless logger.nil?
|
||||
@response.redirect(url, permanently)
|
||||
@performed_redirect = true
|
||||
return false
|
||||
end
|
||||
|
||||
# Resets the session by clearsing out all the objects stored within and initializing a new session object.
|
||||
|
|
Loading…
Reference in a new issue