diff options
author | Joshua Peek <josh@joshpeek.com> | 2009-12-10 22:02:50 -0600 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2009-12-10 22:02:50 -0600 |
commit | 1b82590c36bb1404f7b7a9aa9cf196253685d73f (patch) | |
tree | 33e065c8bc34b6cb4d93996170188219eb138c46 /actionpack/lib/action_controller | |
parent | c517a4fb9a6388ab561615f8556043ce03d531bd (diff) | |
download | rails-1b82590c36bb1404f7b7a9aa9cf196253685d73f.tar.gz rails-1b82590c36bb1404f7b7a9aa9cf196253685d73f.tar.bz2 rails-1b82590c36bb1404f7b7a9aa9cf196253685d73f.zip |
Reduce usage of interpret_status. It should also return a integer
not a string.
Diffstat (limited to 'actionpack/lib/action_controller')
-rw-r--r-- | actionpack/lib/action_controller/base.rb | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/actionpack/lib/action_controller/base.rb b/actionpack/lib/action_controller/base.rb index ed3984c9d4..48bfbab215 100644 --- a/actionpack/lib/action_controller/base.rb +++ b/actionpack/lib/action_controller/base.rb @@ -19,7 +19,6 @@ module ActionController # Legacy modules include SessionManagement - include ActionDispatch::StatusCodes include ActionController::Caching include ActionController::MimeResponds @@ -91,7 +90,7 @@ module ActionController end if options[:status] - options[:status] = interpret_status(options[:status]).to_i + options[:status] = _interpret_status(options[:status]) end options[:update] = blk if block_given? @@ -140,9 +139,9 @@ module ActionController raise ActionControllerError.new("Cannot redirect to nil!") if options.nil? status = if options.is_a?(Hash) && options.key?(:status) - interpret_status(options.delete(:status)) + _interpret_status(options.delete(:status)) elsif response_status.key?(:status) - interpret_status(response_status[:status]) + _interpret_status(response_status[:status]) else 302 end @@ -164,5 +163,14 @@ module ActionController super(url, status) end + + private + def _interpret_status(status) + if status.is_a?(Symbol) + (ActionDispatch::StatusCodes::SYMBOL_TO_STATUS_CODE[status] || 500) + else + status.to_i + end + end end end |