From 38148a0642a998613f20849ea6a34803f8f3429d Mon Sep 17 00:00:00 2001 From: Alexey Vakhov Date: Fri, 13 Apr 2012 11:20:20 +0600 Subject: Fix comment in AD http response response in integration test accessible without @ via attr_reader --- actionpack/lib/action_dispatch/http/response.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actionpack/lib/action_dispatch') diff --git a/actionpack/lib/action_dispatch/http/response.rb b/actionpack/lib/action_dispatch/http/response.rb index 078229efd2..cc46f9983c 100644 --- a/actionpack/lib/action_dispatch/http/response.rb +++ b/actionpack/lib/action_dispatch/http/response.rb @@ -29,7 +29,7 @@ module ActionDispatch # :nodoc: # class DemoControllerTest < ActionDispatch::IntegrationTest # def test_print_root_path_to_console # get('/') - # puts @response.body + # puts response.body # end # end class Response -- cgit v1.2.3 From 86b30c4347640965a6b3ae6a52c5ca9691a585c0 Mon Sep 17 00:00:00 2001 From: Alexey Vakhov Date: Tue, 17 Apr 2012 15:01:41 +0400 Subject: Fix example in flash middleware --- actionpack/lib/action_dispatch/middleware/flash.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actionpack/lib/action_dispatch') diff --git a/actionpack/lib/action_dispatch/middleware/flash.rb b/actionpack/lib/action_dispatch/middleware/flash.rb index cff0877030..c92c91df65 100644 --- a/actionpack/lib/action_dispatch/middleware/flash.rb +++ b/actionpack/lib/action_dispatch/middleware/flash.rb @@ -17,7 +17,7 @@ module ActionDispatch # def create # # save post # flash[:notice] = "Post successfully created" - # redirect_to posts_path(@post) + # redirect_to @post # end # # def show -- cgit v1.2.3 From 8d2487d9d458914bebb83fc74a6957f56dc0a8b5 Mon Sep 17 00:00:00 2001 From: Alexey Vakhov Date: Tue, 17 Apr 2012 15:39:46 +0400 Subject: Fix redirect with block example --- actionpack/lib/action_dispatch/routing/redirection.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'actionpack/lib/action_dispatch') diff --git a/actionpack/lib/action_dispatch/routing/redirection.rb b/actionpack/lib/action_dispatch/routing/redirection.rb index 617b24b46a..797ef84312 100644 --- a/actionpack/lib/action_dispatch/routing/redirection.rb +++ b/actionpack/lib/action_dispatch/routing/redirection.rb @@ -67,10 +67,10 @@ module ActionDispatch # params, depending of how many arguments your block accepts. A string is required as a # return value. # - # match 'jokes/:number', :to => redirect do |params, request| + # match 'jokes/:number', :to => redirect { |params, request| # path = (params[:number].to_i.even? ? "/wheres-the-beef" : "/i-love-lamp") - # "http://#{request.host_with_port}/#{path}" - # end + # "http://#{request.host_with_port}#{path}" + # } # # The options version of redirect allows you to supply only the parts of the url which need # to change, it also supports interpolation of the path similar to the first example. -- cgit v1.2.3 From 5bdf50dbccf65cc4b6a50fe44a98318e9b433b1f Mon Sep 17 00:00:00 2001 From: Oscar Del Ben Date: Tue, 17 Apr 2012 15:57:38 +0200 Subject: Warn about do end syntax in redirect option --- actionpack/lib/action_dispatch/routing/redirection.rb | 3 +++ 1 file changed, 3 insertions(+) (limited to 'actionpack/lib/action_dispatch') diff --git a/actionpack/lib/action_dispatch/routing/redirection.rb b/actionpack/lib/action_dispatch/routing/redirection.rb index 797ef84312..17c1cfb379 100644 --- a/actionpack/lib/action_dispatch/routing/redirection.rb +++ b/actionpack/lib/action_dispatch/routing/redirection.rb @@ -72,6 +72,9 @@ module ActionDispatch # "http://#{request.host_with_port}#{path}" # } # + # Note that the `do end` syntax for the redirect block wouldn't work, as Ruby would pass + # the block to `match` instead of `redirect`. Use `{ ... }` instead. + # # The options version of redirect allows you to supply only the parts of the url which need # to change, it also supports interpolation of the path similar to the first example. # -- cgit v1.2.3 From b7e3c8e1f387e4c0843371971317ca7972d8aeb5 Mon Sep 17 00:00:00 2001 From: Vijay Dev Date: Wed, 18 Apr 2012 00:05:38 +0530 Subject: let's keep the slash in the return value instead of the path variable [ci skip] --- actionpack/lib/action_dispatch/routing/redirection.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'actionpack/lib/action_dispatch') diff --git a/actionpack/lib/action_dispatch/routing/redirection.rb b/actionpack/lib/action_dispatch/routing/redirection.rb index 17c1cfb379..f281738e6f 100644 --- a/actionpack/lib/action_dispatch/routing/redirection.rb +++ b/actionpack/lib/action_dispatch/routing/redirection.rb @@ -68,8 +68,8 @@ module ActionDispatch # return value. # # match 'jokes/:number', :to => redirect { |params, request| - # path = (params[:number].to_i.even? ? "/wheres-the-beef" : "/i-love-lamp") - # "http://#{request.host_with_port}#{path}" + # path = (params[:number].to_i.even? ? "wheres-the-beef" : "i-love-lamp") + # "http://#{request.host_with_port}/#{path}" # } # # Note that the `do end` syntax for the redirect block wouldn't work, as Ruby would pass -- cgit v1.2.3