Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
47e1cca5
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 搜索 >>
提交
47e1cca5
编写于
5月 04, 2011
作者:
X
Xavier Noria
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' of
git://github.com/lifo/docrails
上级
afc3ccf7
2076295a
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
35 addition
and
35 deletion
+35
-35
railties/lib/rails/engine.rb
railties/lib/rails/engine.rb
+16
-16
railties/lib/rails/paths.rb
railties/lib/rails/paths.rb
+19
-19
未找到文件。
railties/lib/rails/engine.rb
浏览文件 @
47e1cca5
...
...
@@ -92,17 +92,17 @@ module Rails
# The available paths in an engine are:
#
# class MyEngine < Rails::Engine
# paths["app"] #=> ["app"]
# paths["app/controllers"] #=> ["app/controllers"]
# paths["app/helpers"] #=> ["app/helpers"]
# paths["app/models"] #=> ["app/models"]
# paths["app/views"] #=> ["app/views"]
# paths["lib"] #=> ["lib"]
# paths["lib/tasks"] #=> ["lib/tasks"]
# paths["config"] #=> ["config"]
# paths["config/initializers"] #=> ["config/initializers"]
# paths["config/locales"] #=> ["config/locales"]
# paths["config/routes"] #=> ["config/routes.rb"]
# paths["app"] #
=> ["app"]
# paths["app/controllers"] #
=> ["app/controllers"]
# paths["app/helpers"] #
=> ["app/helpers"]
# paths["app/models"] #
=> ["app/models"]
# paths["app/views"] #
=> ["app/views"]
# paths["lib"] #
=> ["lib"]
# paths["lib/tasks"] #
=> ["lib/tasks"]
# paths["config"] #
=> ["config"]
# paths["config/initializers"] #
=> ["config/initializers"]
# paths["config/locales"] #
=> ["config/locales"]
# paths["config/routes"] #
=> ["config/routes.rb"]
# end
#
# Your <tt>Application</tt> class adds a couple more paths to this set. And as in your
...
...
@@ -234,14 +234,14 @@ module Rails
# use the prefix "my_engine". In an isolated engine, the prefix will be omitted in url helpers and
# form fields for convenience.
#
# polymorphic_url(MyEngine::Article.new) #=> "articles_path"
# polymorphic_url(MyEngine::Article.new) #
=> "articles_path"
#
# form_for(MyEngine::Article.new) do
# text_field :title #=> <input type="text" name="article[title]" id="article_title" />
# text_field :title #
=> <input type="text" name="article[title]" id="article_title" />
# end
#
# Additionally isolated engine will set its name according to namespace, so
# MyEngine::Engine.engine_name
#=>
"my_engine". It will also set MyEngine.table_name_prefix
# Additionally
an
isolated engine will set its name according to namespace, so
# MyEngine::Engine.engine_name
will be
"my_engine". It will also set MyEngine.table_name_prefix
# to "my_engine_", changing MyEngine::Article model to use my_engine_article table.
#
# == Using Engine's routes outside Engine
...
...
@@ -250,7 +250,7 @@ module Rails
# <tt>url_helpers</tt> inside +Application+. When you mount an engine in an application's routes, a special helper is
# created to allow you to do that. Consider such a scenario:
#
# #
APP/
config/routes.rb
# # config/routes.rb
# MyApplication::Application.routes.draw do
# mount MyEngine::Engine => "/my_engine", :as => "my_engine"
# match "/foo" => "foo#index"
...
...
railties/lib/rails/paths.rb
浏览文件 @
47e1cca5
...
...
@@ -31,23 +31,23 @@ def method_missing(id, *args)
# This means we can get a Path object back like below:
#
# path = root["app/controllers"]
# path.eager_load? #=> true
# path.is_a?(Rails::Paths::Path) #=> true
# path.eager_load? #
=> true
# path.is_a?(Rails::Paths::Path) #
=> true
#
# The Path object is simply an array and allows you to easily add extra paths:
#
# path.is_a?(Array) #=> true
# path.inspect #=> ["app/controllers"]
# path.is_a?(Array) #
=> true
# path.inspect #
=> ["app/controllers"]
#
# path << "lib/controllers"
# path.inspect #=> ["app/controllers", "lib/controllers"]
# path.inspect #
=> ["app/controllers", "lib/controllers"]
#
# Notice that when you add a path using #add, the path object created already
# contains the path with the same path value given to #add. In some situations,
# you may not want this behavior, so you can give :with as option.
#
# root.add "config/routes", :with => "config/routes.rb"
# root["config/routes"].inspect #=> ["config/routes.rb"]
# root["config/routes"].inspect #
=> ["config/routes.rb"]
#
# #add also accepts the following options as argument: eager_load, autoload,
# autoload_once and glob.
...
...
@@ -58,8 +58,8 @@ def method_missing(id, *args)
# root.path = "/rails"
# root.add "app/controllers"
#
# root["app/controllers"].expanded #=> ["/rails/app/controllers"]
# root["app/controllers"].existent #=> ["/rails/app/controllers"]
# root["app/controllers"].expanded #
=> ["/rails/app/controllers"]
# root["app/controllers"].existent #
=> ["/rails/app/controllers"]
#
# Check the Path documentation for more information.
class
Root
<
::
Hash
...
...
@@ -156,17 +156,17 @@ def last
%w(autoload_once eager_load autoload load_path)
.
each
do
|
m
|
class_eval
<<-
RUBY
,
__FILE__
,
__LINE__
+
1
def
#{
m
}
!
@
#{
m
}
= true
end
def skip_
#{
m
}
!
@
#{
m
}
= false
end
def
#{
m
}
?
@
#{
m
}
end
def
#{
m
}
!
# def eager_load!
@
#{
m
}
= true
# @eager_load = true
end
# end
#
def skip_
#{
m
}
!
# def skip_eager_load!
@
#{
m
}
= false
# @eager_load = false
end
# end
#
def
#{
m
}
?
# def eager_load?
@
#{
m
}
# @eager_load
end
# end
RUBY
end
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录