Permalink
Browse files

Merge branch 'master' of github.com:rails/rails

  • Loading branch information...
2 parents c06aff0 + f09ad26 commit fa8849a573aa98750fc5fdacf557d973b85072ca @dhh dhh committed Dec 21, 2009
Showing with 827 additions and 196 deletions.
  1. +1 −1 actionmailer/lib/action_mailer/base.rb
  2. +2 −0 actionpack/CHANGELOG
  3. +2 −2 actionpack/lib/abstract_controller.rb
  4. +1 −0 actionpack/lib/abstract_controller/base.rb
  5. +1 −1 actionpack/lib/abstract_controller/helpers.rb
  6. +1 −1 actionpack/lib/abstract_controller/layouts.rb
  7. +2 −3 actionpack/lib/abstract_controller/{rendering_controller.rb → rendering.rb}
  8. +5 −6 actionpack/lib/action_controller.rb
  9. +5 −6 actionpack/lib/action_controller/base.rb
  10. +7 −2 actionpack/lib/action_controller/metal.rb
  11. +1 −1 actionpack/lib/action_controller/metal/conditional_get.rb
  12. +1 −1 actionpack/lib/action_controller/metal/cookies.rb
  13. +4 −6 actionpack/lib/action_controller/metal/flash.rb
  14. +6 −1 actionpack/lib/action_controller/metal/head.rb
  15. +1 −1 actionpack/lib/action_controller/metal/layouts.rb
  16. +2 −1 actionpack/lib/action_controller/metal/{rack_convenience.rb → rack_delegation.rb}
  17. +3 −11 actionpack/lib/action_controller/metal/{redirector.rb → redirecting.rb}
  18. +3 −4 actionpack/lib/action_controller/metal/{render_options.rb → renderers.rb}
  19. +2 −2 actionpack/lib/action_controller/metal/{rendering_controller.rb → rendering.rb}
  20. +16 −16 actionpack/lib/action_controller/metal/request_forgery_protection.rb
  21. +0 −15 actionpack/lib/action_controller/metal/session.rb
  22. +1 −1 actionpack/lib/action_controller/metal/streaming.rb
  23. +1 −1 actionpack/lib/action_controller/metal/testing.rb
  24. +1 −1 actionpack/lib/action_controller/metal/url_for.rb
  25. +35 −35 actionpack/lib/action_controller/metal/verification.rb
  26. +1 −2 actionpack/lib/action_dispatch.rb
  27. +9 −0 actionpack/lib/action_dispatch/http/request.rb
  28. +1 −1 actionpack/lib/action_dispatch/http/response.rb
  29. +8 −0 actionpack/lib/action_dispatch/http/status_codes.rb
  30. +0 −20 actionpack/lib/action_dispatch/http/utils.rb
  31. +22 −24 actionpack/lib/action_dispatch/middleware/params_parser.rb
  32. +17 −7 actionpack/lib/action_dispatch/routing/mapper.rb
  33. +1 −1 actionpack/lib/action_view.rb
  34. +1 −1 actionpack/test/abstract/abstract_controller_test.rb
  35. +1 −1 actionpack/test/abstract/helper_test.rb
  36. +1 −1 actionpack/test/abstract/layouts_test.rb
  37. +1 −1 actionpack/test/abstract/localized_cache_test.rb
  38. +1 −1 actionpack/test/abstract/render_test.rb
  39. +34 −3 actionpack/test/dispatch/routing_test.rb
  40. +2 −1 activeresource/lib/active_resource.rb
  41. +138 −2 activeresource/lib/active_resource/base.rb
  42. +55 −0 activeresource/lib/active_resource/schema.rb
  43. +419 −0 activeresource/test/cases/base/schema_test.rb
  44. +1 −0 activesupport/lib/active_support/core_ext/date/calculations.rb
  45. +1 −0 activesupport/lib/active_support/core_ext/date/conversions.rb
  46. +1 −0 activesupport/lib/active_support/core_ext/time/calculations.rb
  47. +1 −0 activesupport/lib/active_support/ruby/shim.rb
  48. +3 −5 railties/lib/rails/generators/rails/app/templates/app/controllers/application_controller.rb
  49. +4 −6 railties/lib/rails/generators/rails/app/templates/config/routes.rb
@@ -253,7 +253,7 @@ module ActionMailer #:nodoc:
class Base
include AdvAttrAccessor, PartContainer, Quoting, Utils
- include AbstractController::RenderingController
+ include AbstractController::Rendering
include AbstractController::LocalizedCache
include AbstractController::Layouts
View
@@ -1,5 +1,7 @@
*Edge*
+* Added ActionDispatch::Request#authorization to access the http authentication header regardless of its proxy hiding [DHH]
+
* Added :alert, :notice, and :flash as options to ActionController::Base#redirect_to that'll automatically set the proper flash before the redirection [DHH]. Examples:
flash[:notice] = 'Post was created'
@@ -1,7 +1,7 @@
activesupport_path = File.expand_path('../../../activesupport/lib', __FILE__)
$:.unshift(activesupport_path) if File.directory?(activesupport_path) && !$:.include?(activesupport_path)
-require 'active_support'
+require 'active_support/ruby/shim'
require 'active_support/core_ext/module/attr_internal'
require 'active_support/core_ext/module/delegation'
@@ -15,6 +15,6 @@ module AbstractController
autoload :Layouts
autoload :LocalizedCache
autoload :Logger
- autoload :RenderingController
+ autoload :Rendering
end
end
@@ -5,6 +5,7 @@ class ActionNotFound < StandardError; end
class Base
attr_internal :response_body
attr_internal :action_name
+ attr_internal :formats
class << self
attr_reader :abstract
@@ -4,7 +4,7 @@ module AbstractController
module Helpers
extend ActiveSupport::Concern
- include RenderingController
+ include Rendering
def self.next_serial
@helper_serial ||= 0
@@ -2,7 +2,7 @@ module AbstractController
module Layouts
extend ActiveSupport::Concern
- include RenderingController
+ include Rendering
included do
extlib_inheritable_accessor(:_layout_conditions) { Hash.new }
@@ -10,13 +10,12 @@ def initialize(message = nil)
end
end
- module RenderingController
+ module Rendering
extend ActiveSupport::Concern
include AbstractController::Logger
included do
- attr_internal :formats
extlib_inheritable_accessor :_view_paths
self._view_paths ||= ActionView::PathSet.new
end
@@ -80,7 +79,7 @@ def render_to_body(options = {})
#
# :api: plugin
def render_to_string(options = {})
- AbstractController::RenderingController.body_to_s(render_to_body(options))
+ AbstractController::Rendering.body_to_s(render_to_body(options))
end
# Renders the template from an object.
@@ -1,6 +1,6 @@
activesupport_path = File.expand_path('../../../activesupport/lib', __FILE__)
$:.unshift(activesupport_path) if File.directory?(activesupport_path) && !$:.include?(activesupport_path)
-require 'active_support'
+require 'active_support/ruby/shim'
module ActionController
extend ActiveSupport::Autoload
@@ -22,14 +22,13 @@ module ActionController
autoload :HideActions
autoload :Layouts
autoload :MimeResponds
- autoload :RackConvenience
+ autoload :RackDelegation
autoload :Compatibility
- autoload :Redirector
- autoload :RenderingController
- autoload :RenderOptions
+ autoload :Redirecting
+ autoload :Rendering
+ autoload :Renderers
autoload :Rescue
autoload :Responder
- autoload :Session
autoload :SessionManagement
autoload :UrlFor
autoload :Verification
@@ -8,12 +8,12 @@ class Base < Metal
include ActionController::Helpers
include ActionController::HideActions
include ActionController::UrlFor
- include ActionController::Redirector
- include ActionController::RenderingController
- include ActionController::RenderOptions::All
+ include ActionController::Redirecting
+ include ActionController::Rendering
+ include ActionController::Renderers::All
include ActionController::Layouts
include ActionController::ConditionalGet
- include ActionController::RackConvenience
+ include ActionController::RackDelegation
include ActionController::Benchmarking
include ActionController::Configuration
@@ -26,7 +26,6 @@ class Base < Metal
include ActionController::Compatibility
include ActionController::Cookies
- include ActionController::Session
include ActionController::Flash
include ActionController::Verification
include ActionController::RequestForgeryProtection
@@ -90,7 +89,7 @@ def _normalize_options(action = nil, options = {}, &blk)
end
if options[:status]
- options[:status] = _interpret_status(options[:status])
+ options[:status] = ActionDispatch::StatusCodes[options[:status]]
end
options[:update] = blk if block_given?
@@ -45,7 +45,7 @@ def controller_path
# The details below can be overridden to support a specific
# Request and Response object. The default ActionController::Base
- # implementation includes RackConvenience, which makes a request
+ # implementation includes RackDelegation, which makes a request
# and response object available. You might wish to control the
# environment and response manually for performance reasons.
@@ -57,7 +57,7 @@ def initialize(*)
end
# Basic implementations for content_type=, location=, and headers are
- # provided to reduce the dependency on the RackConvenience module
+ # provided to reduce the dependency on the RackDelegation module
# in Renderer and Redirector.
def content_type=(type)
@@ -68,6 +68,10 @@ def location=(url)
headers["Location"] = url
end
+ def status=(status)
+ @_status = ActionDispatch::StatusCodes[status]
+ end
+
# :api: private
def dispatch(name, env)
@_env = env
@@ -92,6 +96,7 @@ def self.for(controller, action, stack)
def initialize(controller, action)
@controller, @action = controller, action
+ @_formats = [Mime::HTML]
end
def call(env)
@@ -2,7 +2,7 @@ module ActionController
module ConditionalGet
extend ActiveSupport::Concern
- include RackConvenience
+ include RackDelegation
include Head
# Sets the etag, last_modified, or both on the response and renders a
@@ -46,7 +46,7 @@ module ActionController #:nodoc:
module Cookies
extend ActiveSupport::Concern
- include RackConvenience
+ include RackDelegation
included do
helper_method :cookies
@@ -28,8 +28,6 @@ module ActionController #:nodoc:
module Flash
extend ActiveSupport::Concern
- include Session
-
included do
helper_method :alert, :notice
end
@@ -155,7 +153,7 @@ def flash #:doc:
def alert
flash[:alert]
end
-
+
# Convenience accessor for flash[:alert]=
def alert=(message)
flash[:alert] = message
@@ -165,7 +163,7 @@ def alert=(message)
def notice
flash[:notice]
end
-
+
# Convenience accessor for flash[:notice]=
def notice=(message)
flash[:notice] = message
@@ -193,11 +191,11 @@ def redirect_to(options = {}, response_status_and_flash = {}) #:doc:
if notice = response_status_and_flash.delete(:notice)
flash[:notice] = notice
end
-
+
if other_flashes = response_status_and_flash.delete(:flash)
flash.update(other_flashes)
end
-
+
super(options, response_status_and_flash)
end
end
@@ -1,5 +1,7 @@
module ActionController
module Head
+ include UrlFor
+
# Return a response that has no content (merely headers). The options
# argument is interpreted to be a hash of header names and values.
# This allows you to easily return a response that consists only of
@@ -21,7 +23,10 @@ def head(status, options = {})
headers[key.to_s.dasherize.split(/-/).map { |v| v.capitalize }.join("-")] = value.to_s
end
- render :nothing => true, :status => status, :location => location
+ self.status = status
+ self.location = url_for(location) if location
+ self.content_type = Mime[formats.first]
+ self.response_body = " "
end
end
end
@@ -158,7 +158,7 @@ module ActionController
module Layouts
extend ActiveSupport::Concern
- include ActionController::RenderingController
+ include ActionController::Rendering
include AbstractController::Layouts
module ClassMethods
@@ -1,8 +1,9 @@
module ActionController
- module RackConvenience
+ module RackDelegation
extend ActiveSupport::Concern
included do
+ delegate :session, :reset_session, :to => "@_request"
delegate :headers, :status=, :location=, :content_type=,
:status, :location, :content_type, :to => "@_response"
attr_internal :request
@@ -7,7 +7,7 @@ def initialize(message = nil)
end
end
- module Redirector
+ module Redirecting
extend ActiveSupport::Concern
include AbstractController::Logger
@@ -62,9 +62,9 @@ def redirect_to(options = {}, response_status = {}) #:doc:
private
def _extract_redirect_to_status(options, response_status)
status = if options.is_a?(Hash) && options.key?(:status)
- _interpret_status(options.delete(:status))
+ ActionDispatch::StatusCodes[options.delete(:status)]
elsif response_status.key?(:status)
- _interpret_status(response_status[:status])
+ ActionDispatch::StatusCodes[response_status[:status]]
else
302
end
@@ -86,13 +86,5 @@ def _compute_redirect_to_location(options)
url_for(options)
end.gsub(/[\r\n]/, '')
end
-
- 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
@@ -1,10 +1,9 @@
module ActionController
-
def self.add_renderer(key, &block)
- RenderOptions.add(key, &block)
+ Renderers.add(key, &block)
end
- module RenderOptions
+ module Renderers
extend ActiveSupport::Concern
included do
@@ -52,7 +51,7 @@ def self.add(key, &block)
module All
extend ActiveSupport::Concern
- include RenderOptions
+ include Renderers
INCLUDED = []
included do
@@ -1,9 +1,9 @@
module ActionController
- module RenderingController
+ module Rendering
extend ActiveSupport::Concern
included do
- include AbstractController::RenderingController
+ include AbstractController::Rendering
include AbstractController::LocalizedCache
end
Oops, something went wrong.

0 comments on commit fa8849a

Please sign in to comment.