Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
ed8962c8
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,体验更适合开发者的 AI 搜索 >>
提交
ed8962c8
编写于
5月 09, 2011
作者:
S
Sebastian Martinez
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
more fixed-fonts here
上级
56a7db6e
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
23 addition
and
23 deletion
+23
-23
actionpack/lib/action_dispatch/routing/mapper.rb
actionpack/lib/action_dispatch/routing/mapper.rb
+23
-23
未找到文件。
actionpack/lib/action_dispatch/routing/mapper.rb
浏览文件 @
ed8962c8
...
...
@@ -335,7 +335,7 @@ def root(options = {})
#
# [:on]
# Shorthand for wrapping routes in a specific RESTful context. Valid
# values are
:member, :collection, and :new
. Only use within
# values are
+:member+, +:collection+, and +:new+
. Only use within
# <tt>resource(s)</tt> block. For example:
#
# resource :bar do
...
...
@@ -352,7 +352,7 @@ def root(options = {})
#
# [:constraints]
# Constrains parameters with a hash of regular expressions or an
# object that responds to
#matches?
# object that responds to
<tt>#matches?</tt>
#
# match 'path/:id', :constraints => { :id => /[A-Z]\d{5}/ }
#
...
...
@@ -373,7 +373,7 @@ def root(options = {})
# See <tt>Scoping#defaults</tt> for its scope equivalent.
#
# [:anchor]
# Boolean to anchor a
#match
pattern. Default is true. When set to
# Boolean to anchor a
<tt>#match</tt>
pattern. Default is true. When set to
# false, the pattern matches any request prefixed with the given path.
#
# # Matches any request starting with 'path'
...
...
@@ -517,15 +517,15 @@ def map_method(method, *args, &block)
# You may wish to organize groups of controllers under a namespace.
# Most commonly, you might group a number of administrative controllers
# under an +admin+ namespace. You would place these controllers under
# the
app/controllers/admin directory, and you can group them together
# in your router:
# the
<tt>app/controllers/admin</tt> directory, and you can group them
#
together
in your router:
#
# namespace "admin" do
# resources :posts, :comments
# end
#
# This will create a number of routes for each of the posts and comments
# controller. For
Admin::PostsController
, Rails will create:
# controller. For
<tt>Admin::PostsController</tt>
, Rails will create:
#
# GET /admin/posts
# GET /admin/posts/new
...
...
@@ -536,7 +536,7 @@ def map_method(method, *args, &block)
# DELETE /admin/posts/1
#
# If you want to route /posts (without the prefix /admin) to
#
Admin::PostsController
, you could use
#
<tt>Admin::PostsController</tt>
, you could use
#
# scope :module => "admin" do
# resources :posts
...
...
@@ -546,7 +546,7 @@ def map_method(method, *args, &block)
#
# resources :posts, :module => "admin"
#
# If you want to route /admin/posts to
PostsController
# If you want to route /admin/posts to
+PostsController+
# (without the Admin:: module prefix), you could use
#
# scope "/admin" do
...
...
@@ -559,7 +559,7 @@ def map_method(method, *args, &block)
#
# In each of these cases, the named routes remain the same as if you did
# not use scope. In the last case, the following paths map to
#
PostsController
:
#
+PostsController+
:
#
# GET /admin/posts
# GET /admin/posts/new
...
...
@@ -587,7 +587,7 @@ module Scoping
#
# === Examples
#
# # route /posts (without the prefix /admin) to
Admin::PostsController
# # route /posts (without the prefix /admin) to
<tt>Admin::PostsController</tt>
# scope :module => "admin" do
# resources :posts
# end
...
...
@@ -597,7 +597,7 @@ module Scoping
# resources :posts
# end
#
# # prefix the routing helper name:
sekret_posts_path instead of posts_path
# # prefix the routing helper name:
+sekret_posts_path+ instead of +posts_path+
# scope :as => "sekret" do
# resources :posts
# end
...
...
@@ -679,12 +679,12 @@ def controller(controller, options={})
# resources :posts
# end
#
# # maps to
Sekret::PostsController rather than Admin::PostsController
# # maps to
<tt>Sekret::PostsController</tt> rather than <tt>Admin::PostsController</tt>
# namespace :admin, :module => "sekret" do
# resources :posts
# end
#
# # generates
sekret_posts_path rather than admin_posts_path
# # generates
+sekret_posts_path+ rather than +admin_posts_path+
# namespace :admin, :as => "sekret" do
# resources :posts
# end
...
...
@@ -846,20 +846,20 @@ def override_keys(child) #:nodoc:
# You may wish to organize groups of controllers under a namespace. Most
# commonly, you might group a number of administrative controllers under
# an +admin+ namespace. You would place these controllers under the
#
app/controllers/admin directory, and you can group them together in you
r
# router:
#
<tt>app/controllers/admin</tt> directory, and you can group them togethe
r
#
in your
router:
#
# namespace "admin" do
# resources :posts, :comments
# end
#
# By default the
:id
parameter doesn't accept dots. If you need to
# use dots as part of the
:id
parameter add a constraint which
# By default the
+:id+
parameter doesn't accept dots. If you need to
# use dots as part of the
+:id+
parameter add a constraint which
# overrides this restriction, e.g:
#
# resources :articles, :id => /[^\/]+/
#
# This allows any character other than a slash as part of your
:id
.
# This allows any character other than a slash as part of your
+:id+
.
#
module
Resources
# CANONICAL_ACTIONS holds all actions that does not need a prefix or
...
...
@@ -975,7 +975,7 @@ def resources_path_names(options)
# resource :geocoder
#
# creates six different routes in your application, all mapping to
# the
GeoCoders
controller (note that the controller is named after
# the
+GeoCoders+
controller (note that the controller is named after
# the plural):
#
# GET /geocoder/new
...
...
@@ -1024,7 +1024,7 @@ def resource(*resources, &block)
# resources :photos
#
# creates seven different routes in your application, all mapping to
# the
Photos
controller:
# the
+Photos+
controller:
#
# GET /photos/new
# POST /photos
...
...
@@ -1107,7 +1107,7 @@ def resource(*resources, &block)
#
# === Examples
#
# # routes call
Admin::PostsController
# # routes call
<tt>Admin::PostsController</tt>
# resources :posts, :module => "admin"
#
# # resource actions are at /admin/posts.
...
...
@@ -1151,7 +1151,7 @@ def resources(*resources, &block)
# end
#
# This will enable Rails to recognize paths such as <tt>/photos/search</tt>
# with GET, and route to the search action of
PhotosController
. It will also
# with GET, and route to the search action of
+PhotosController+
. It will also
# create the <tt>search_photos_url</tt> and <tt>search_photos_path</tt>
# route helpers.
def
collection
...
...
@@ -1175,7 +1175,7 @@ def collection
# end
#
# This will recognize <tt>/photos/1/preview</tt> with GET, and route to the
# preview action of
PhotosController
. It will also create the
# preview action of
+PhotosController+
. It will also create the
# <tt>preview_photo_url</tt> and <tt>preview_photo_path</tt> helpers.
def
member
unless
resource_scope?
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录