Deprecate render_component.
Please install render_component plugin from http://github.com/rails/render_component/tree/master if your application uses this functionality.
This commit is contained in:
parent
85070b5e56
commit
6577942b61
|
@ -1,5 +1,7 @@
|
|||
*Edge*
|
||||
|
||||
* Deprecate render_component. Please use render_component plugin from http://github.com/rails/render_component/tree/master [Pratik]
|
||||
|
||||
* Routes may be restricted to lists of HTTP methods instead of a single method or :any. #407 [Brennan Dunn, Gaius Centus Novus]
|
||||
map.resource :posts, :collection => { :search => [:get, :post] }
|
||||
map.session 'session', :requirements => { :method => [:get, :post, :delete] }
|
||||
|
|
|
@ -548,12 +548,16 @@ module ActionController #:nodoc:
|
|||
@@guard.synchronize { send(method, *arguments) }
|
||||
end
|
||||
|
||||
response.prepare! unless component_request?
|
||||
response
|
||||
send_response
|
||||
ensure
|
||||
process_cleanup
|
||||
end
|
||||
|
||||
def send_response
|
||||
response.prepare! unless component_request?
|
||||
response
|
||||
end
|
||||
|
||||
# Returns a URL that has been rewritten according to the options hash and the defined Routes.
|
||||
# (For doing a complete redirect, use redirect_to).
|
||||
#
|
||||
|
|
|
@ -38,6 +38,7 @@ module ActionController #:nodoc:
|
|||
def self.included(base) #:nodoc:
|
||||
base.class_eval do
|
||||
include InstanceMethods
|
||||
include ActiveSupport::Deprecation
|
||||
extend ClassMethods
|
||||
helper HelperMethods
|
||||
|
||||
|
@ -82,6 +83,7 @@ module ActionController #:nodoc:
|
|||
render_for_text(component_response(options, true).body, response.headers["Status"])
|
||||
end
|
||||
end
|
||||
deprecate :render_component => "Please install render_component plugin from http://github.com/rails/render_component/tree/master"
|
||||
|
||||
# Returns the component response as a string
|
||||
def render_component_as_string(options) #:doc:
|
||||
|
@ -95,6 +97,7 @@ module ActionController #:nodoc:
|
|||
end
|
||||
end
|
||||
end
|
||||
deprecate :render_component_as_string => "Please install render_component plugin from http://github.com/rails/render_component/tree/master"
|
||||
|
||||
def flash_with_components(refresh = false) #:nodoc:
|
||||
if !defined?(@_flash) || refresh
|
||||
|
|
|
@ -77,49 +77,64 @@ class ComponentsTest < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_calling_from_controller
|
||||
get :calling_from_controller
|
||||
assert_equal "Lady of the House, speaking", @response.body
|
||||
assert_deprecated do
|
||||
get :calling_from_controller
|
||||
assert_equal "Lady of the House, speaking", @response.body
|
||||
end
|
||||
end
|
||||
|
||||
def test_calling_from_controller_with_params
|
||||
get :calling_from_controller_with_params
|
||||
assert_equal "David of the House, speaking", @response.body
|
||||
assert_deprecated do
|
||||
get :calling_from_controller_with_params
|
||||
assert_equal "David of the House, speaking", @response.body
|
||||
end
|
||||
end
|
||||
|
||||
def test_calling_from_controller_with_different_status_code
|
||||
get :calling_from_controller_with_different_status_code
|
||||
assert_equal 500, @response.response_code
|
||||
assert_deprecated do
|
||||
get :calling_from_controller_with_different_status_code
|
||||
assert_equal 500, @response.response_code
|
||||
end
|
||||
end
|
||||
|
||||
def test_calling_from_template
|
||||
get :calling_from_template
|
||||
assert_equal "Ring, ring: Lady of the House, speaking", @response.body
|
||||
assert_deprecated do
|
||||
get :calling_from_template
|
||||
assert_equal "Ring, ring: Lady of the House, speaking", @response.body
|
||||
end
|
||||
end
|
||||
|
||||
def test_etag_is_set_for_parent_template_when_calling_from_template
|
||||
get :calling_from_template
|
||||
expected_etag = etag_for("Ring, ring: Lady of the House, speaking")
|
||||
assert_equal expected_etag, @response.headers['ETag']
|
||||
assert_deprecated do
|
||||
get :calling_from_template
|
||||
expected_etag = etag_for("Ring, ring: Lady of the House, speaking")
|
||||
assert_equal expected_etag, @response.headers['ETag']
|
||||
end
|
||||
end
|
||||
|
||||
def test_internal_calling
|
||||
get :internal_caller
|
||||
assert_equal "Are you there? Yes, ma'am", @response.body
|
||||
assert_deprecated do
|
||||
get :internal_caller
|
||||
assert_equal "Are you there? Yes, ma'am", @response.body
|
||||
end
|
||||
end
|
||||
|
||||
def test_flash
|
||||
get :set_flash
|
||||
assert_equal 'My stoney baby', flash[:notice]
|
||||
get :use_flash
|
||||
assert_equal 'My stoney baby', @response.body
|
||||
get :use_flash
|
||||
assert_equal 'no flash', @response.body
|
||||
assert_deprecated do
|
||||
get :set_flash
|
||||
assert_equal 'My stoney baby', flash[:notice]
|
||||
get :use_flash
|
||||
assert_equal 'My stoney baby', @response.body
|
||||
get :use_flash
|
||||
assert_equal 'no flash', @response.body
|
||||
end
|
||||
end
|
||||
|
||||
def test_component_redirect_redirects
|
||||
get :calling_redirected
|
||||
|
||||
assert_redirected_to :controller=>"callee", :action => "being_called"
|
||||
assert_deprecated do
|
||||
get :calling_redirected
|
||||
assert_redirected_to :controller=>"callee", :action => "being_called"
|
||||
end
|
||||
end
|
||||
|
||||
def test_component_multiple_redirect_redirects
|
||||
|
@ -128,9 +143,10 @@ class ComponentsTest < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_component_as_string_redirect_renders_redirected_action
|
||||
get :calling_redirected_as_string
|
||||
|
||||
assert_equal "Lady of the House, speaking", @response.body
|
||||
assert_deprecated do
|
||||
get :calling_redirected_as_string
|
||||
assert_equal "Lady of the House, speaking", @response.body
|
||||
end
|
||||
end
|
||||
|
||||
protected
|
||||
|
|
|
@ -109,7 +109,7 @@ module ActiveSupport
|
|||
end
|
||||
|
||||
def deprecation_horizon
|
||||
'2.0'
|
||||
'2.3'
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue