Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
7fcc5829
R
rails
项目概览
张重言
/
rails
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rails
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
7fcc5829
编写于
5月 02, 2014
作者:
R
Robin Dupret
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Tiny follow up to #14915 [ci skip]
上级
d4a2f7e8
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
18 addition
and
19 deletion
+18
-19
actionpack/lib/action_dispatch/routing/mapper.rb
actionpack/lib/action_dispatch/routing/mapper.rb
+18
-19
未找到文件。
actionpack/lib/action_dispatch/routing/mapper.rb
浏览文件 @
7fcc5829
...
...
@@ -346,13 +346,12 @@ def root(options = {})
# without specifying an HTTP method.
#
# If you want to expose your action to both GET and POST, use:
#
#
# # sets :controller, :action and :id in params
# match ':controller/:action/:id', via: [:get, :post]
#
# Note that +:controller+, +:action+, +:id+ are interpreted as url query
# parameters and thus available as +params+
# in an action.
# Note that +:controller+, +:action+ and +:id+ are interpreted as url
# query parameters and thus available through +params+ in an action.
#
# If you want to expose your action to GET, use `get` in the router:
#
...
...
@@ -381,17 +380,17 @@ def root(options = {})
# When a pattern points to an internal route, the route's +:action+ and
# +:controller+ should be set in options or hash shorthand. Examples:
#
# match 'photos/:id' => 'photos#show', via:
[:get]
# match 'photos/:id', to: 'photos#show', via:
[:get]
# match 'photos/:id', controller: 'photos', action: 'show', via:
[:get]
# match 'photos/:id' => 'photos#show', via:
:get
# match 'photos/:id', to: 'photos#show', via:
:get
# match 'photos/:id', controller: 'photos', action: 'show', via:
:get
#
# 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"]] }, via:
[:get]
# match 'photos/:id', to: PhotoRackApp, via:
[:get]
# match 'photos/:id', to: lambda {|hash| [200, {}, ["Coming soon"]] }, via:
:get
# match 'photos/:id', to: PhotoRackApp, via:
:get
# # Yes, controller actions are just rack endpoints
# match 'photos/:id', to: PhotosController.action(:show), via:
[:get]
# match 'photos/:id', to: PhotosController.action(:show), via:
:get
#
# Because requesting various HTTP verbs with a single action has security
# implications, you must either specify the actions in
...
...
@@ -414,7 +413,7 @@ def root(options = {})
# [:module]
# The namespace for :controller.
#
# match 'path', to: 'c#a', module: 'sekret', controller: 'posts', via:
[:get]
# match 'path', to: 'c#a', module: 'sekret', controller: 'posts', via:
:get
# # => Sekret::PostsController
#
# See <tt>Scoping#namespace</tt> for its scope equivalent.
...
...
@@ -433,9 +432,9 @@ def root(options = {})
# Points to a +Rack+ endpoint. Can be an object that responds to
# +call+ or a string representing a controller's action.
#
# match 'path', to: 'controller#action', via:
[:get]
# match 'path', to: lambda { |env| [200, {}, ["Success!"]] }, via:
[:get]
# match 'path', to: RackApp, via:
[:get]
# match 'path', to: 'controller#action', via:
:get
# match 'path', to: lambda { |env| [200, {}, ["Success!"]] }, via:
:get
# match 'path', to: RackApp, via:
:get
#
# [:on]
# Shorthand for wrapping routes in a specific RESTful context. Valid
...
...
@@ -460,14 +459,14 @@ def root(options = {})
# other than path can also be specified with any object
# that responds to <tt>===</tt> (eg. String, Array, Range, etc.).
#
# match 'path/:id', constraints: { id: /[A-Z]\d{5}/ }, via:
[:get]
# match 'path/:id', constraints: { id: /[A-Z]\d{5}/ }, via:
:get
#
# match 'json_only', constraints: { format: 'json' }, via:
[:get]
# match 'json_only', constraints: { format: 'json' }, via:
:get
#
# class Whitelist
# def matches?(request) request.remote_ip == '1.2.3.4' end
# end
# match 'path', to: 'c#a', constraints: Whitelist.new, via:
[:get]
# match 'path', to: 'c#a', constraints: Whitelist.new, via:
:get
#
# See <tt>Scoping#constraints</tt> for more examples with its scope
# equivalent.
...
...
@@ -476,7 +475,7 @@ def root(options = {})
# Sets defaults for parameters
#
# # Sets params[:format] to 'jpg' by default
# match 'path', to: 'c#a', defaults: { format: 'jpg' }, via:
[:get]
# match 'path', to: 'c#a', defaults: { format: 'jpg' }, via:
:get
#
# See <tt>Scoping#defaults</tt> for its scope equivalent.
#
...
...
@@ -485,7 +484,7 @@ def root(options = {})
# false, the pattern matches any request prefixed with the given path.
#
# # Matches any request starting with 'path'
# match 'path', to: 'c#a', anchor: false, via:
[:get]
# match 'path', to: 'c#a', anchor: false, via:
:get
#
# [:format]
# Allows you to specify the default value for optional +format+
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录