mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Merge pull request #8666 from mekishizufu/fix_lambdas
Fix usage of lambda as a Rack endpoint
This commit is contained in:
commit
cf2dcf4e9f
3 changed files with 4 additions and 4 deletions
|
@ -315,7 +315,7 @@ module ActionDispatch
|
|||
# A pattern can also point to a +Rack+ endpoint i.e. anything that
|
||||
# responds to +call+:
|
||||
#
|
||||
# match 'photos/:id', to: lambda {|hash| [200, {}, "Coming soon"] }
|
||||
# match 'photos/:id', to: lambda {|hash| [200, {}, ["Coming soon"]] }
|
||||
# match 'photos/:id', to: PhotoRackApp
|
||||
# # Yes, controller actions are just rack endpoints
|
||||
# match 'photos/:id', to: PhotosController.action(:show)
|
||||
|
@ -360,7 +360,7 @@ module ActionDispatch
|
|||
# +call+ or a string representing a controller's action.
|
||||
#
|
||||
# match 'path', to: 'controller#action'
|
||||
# match 'path', to: lambda { |env| [200, {}, "Success!"] }
|
||||
# match 'path', to: lambda { |env| [200, {}, ["Success!"]] }
|
||||
# match 'path', to: RackApp
|
||||
#
|
||||
# [:on]
|
||||
|
|
|
@ -45,7 +45,7 @@ module ApplicationTests
|
|||
|
||||
app_file 'config/routes.rb', <<-RUBY
|
||||
AppTemplate::Application.routes.draw do
|
||||
get '*path', to: lambda { |env| [200, { "Content-Type" => "text/html" }, "Not an asset"] }
|
||||
get '*path', to: lambda { |env| [200, { "Content-Type" => "text/html" }, ["Not an asset"]] }
|
||||
end
|
||||
RUBY
|
||||
|
||||
|
|
|
@ -568,7 +568,7 @@ YAML
|
|||
@plugin.write "lib/bukkits.rb", <<-RUBY
|
||||
module Bukkits
|
||||
class Engine < ::Rails::Engine
|
||||
endpoint lambda { |env| [200, {'Content-Type' => 'text/html'}, 'hello'] }
|
||||
endpoint lambda { |env| [200, {'Content-Type' => 'text/html'}, ['hello']] }
|
||||
end
|
||||
end
|
||||
RUBY
|
||||
|
|
Loading…
Reference in a new issue