mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
fixing English in Rails::Engine docs
[ci skip]
This commit is contained in:
parent
805bfc9886
commit
82dc25de6f
1 changed files with 26 additions and 17 deletions
|
@ -206,42 +206,51 @@ module Rails
|
||||||
# With such an engine, everything that is inside the +MyEngine+ module will be isolated from
|
# With such an engine, everything that is inside the +MyEngine+ module will be isolated from
|
||||||
# the application.
|
# the application.
|
||||||
#
|
#
|
||||||
# Consider such controller:
|
# Consider this controller:
|
||||||
#
|
#
|
||||||
# module MyEngine
|
# module MyEngine
|
||||||
# class FooController < ActionController::Base
|
# class FooController < ActionController::Base
|
||||||
# end
|
# end
|
||||||
# end
|
# end
|
||||||
#
|
#
|
||||||
# If an engine is marked as isolated, +FooController+ has access only to helpers from +Engine+ and
|
# If the +MyEngine+ engine is marked as isolated, +FooController+ only has
|
||||||
# <tt>url_helpers</tt> from <tt>MyEngine::Engine.routes</tt>.
|
# access to helpers from +MyEngine+, and <tt>url_helpers</tt> from
|
||||||
|
# <tt>MyEngine::Engine.routes</tt>.
|
||||||
#
|
#
|
||||||
# The next thing that changes in isolated engines is the behavior of routes. Normally, when you namespace
|
# The next thing that changes in isolated engines is the behavior of routes.
|
||||||
# your controllers, you also need to namespace all your routes. With an isolated engine,
|
# Normally, when you namespace your controllers, you also need to namespace
|
||||||
# the namespace is applied by default, so you can ignore it in routes:
|
# the related routes. With an isolated engine, the engine's namespace is
|
||||||
|
# automatically applied, so you don't need to specify it explicity in your
|
||||||
|
# routes:
|
||||||
#
|
#
|
||||||
# MyEngine::Engine.routes.draw do
|
# MyEngine::Engine.routes.draw do
|
||||||
# resources :articles
|
# resources :articles
|
||||||
# end
|
# end
|
||||||
#
|
#
|
||||||
# The routes above will automatically point to <tt>MyEngine::ArticlesController</tt>. Furthermore, you don't
|
# If +MyEngine+ is isolated, The routes above will point to
|
||||||
# need to use longer url helpers like <tt>my_engine_articles_path</tt>. Instead, you should simply use
|
# <tt>MyEngine::ArticlesController</tt>. You also don't need to use longer
|
||||||
# <tt>articles_path</tt> as you would do with your application.
|
# url helpers like +my_engine_articles_path+. Instead, you should simply use
|
||||||
|
# +articles_path+, like you would do with your main application.
|
||||||
#
|
#
|
||||||
# To make that behavior consistent with other parts of the framework, an isolated engine also has influence on
|
# To make this behavior consistent with other parts of the framework,
|
||||||
# <tt>ActiveModel::Naming</tt>. When you use a namespaced model, like <tt>MyEngine::Article</tt>, it will normally
|
# isolated engines also have an effect on <tt>ActiveModel::Naming</tt>. In a
|
||||||
# use the prefix "my_engine". In an isolated engine, the prefix will be omitted in url helpers and
|
# normal Rails app, when you use a namespaced model such as
|
||||||
# form fields for convenience.
|
# <tt>Namespace::Article</tt>, <tt>ActiveModel::Naming</tt> will generate
|
||||||
|
# names with the prefix "namespace". 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" # not "my_engine_articles_path"
|
||||||
#
|
#
|
||||||
# form_for(MyEngine::Article.new) do
|
# 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
|
# end
|
||||||
#
|
#
|
||||||
# Additionally, an isolated engine will set its name according to namespace, so
|
# Additionally, an isolated engine will set its own name according to its
|
||||||
# MyEngine::Engine.engine_name will be "my_engine". It will also set MyEngine.table_name_prefix
|
# namespace, so <tt>MyEngine::Engine.engine_name</tt> will return
|
||||||
# to "my_engine_", changing the MyEngine::Article model to use the my_engine_articles table.
|
# "my_engine". It will also set +MyEngine.table_name_prefix+ to "my_engine_",
|
||||||
|
# meaning for example that <tt>MyEngine::Article</tt> will use the
|
||||||
|
# +my_engine_articles+ database table by default.
|
||||||
#
|
#
|
||||||
# == Using Engine's routes outside Engine
|
# == Using Engine's routes outside Engine
|
||||||
#
|
#
|
||||||
|
|
Loading…
Reference in a new issue