From 07411ca4907ec32d9c23619390cf50c7c0c1af07 Mon Sep 17 00:00:00 2001 From: Piotr Sarnacki Date: Mon, 20 Sep 2010 21:27:43 +0200 Subject: List all of isolated engine changes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: José Valim --- railties/lib/rails/engine.rb | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) (limited to 'railties/lib') diff --git a/railties/lib/rails/engine.rb b/railties/lib/rails/engine.rb index fd91185a47..0620b8608e 100644 --- a/railties/lib/rails/engine.rb +++ b/railties/lib/rails/engine.rb @@ -211,12 +211,30 @@ module Rails # end # end # - # If engine is marked as namespaced, FooController has access only to helpers from engine and + # If engine is marked as isolated, FooController has access only to helpers from engine and # url_helpers from MyEngine::Engine.routes. # + # The next thing that changes in isolated engine is routes behaviour. Normally, when you namespace + # your controllers, you need to use scope or namespace method in routes. With isolated engine, + # the namespace is applied by default, so you can ignore it in routes. Further more, you don't need + # to use longer url helpers like "my_engine_articles_path". As the prefix is not set you can just use + # articles_path as you would normally do. + # + # To make that behaviour consistent with other parts of framework, isolated engine has influence also on + # ActiveModel::Naming. When you use namespaced model, like MyEngine::Article, it will normally + # use the prefix "my_engine". In isolated engine, the prefix will be ommited in most of the places, + # like url helpers or form fields. + # + # polymorphic_url(MyEngine::Article.new) #=> "articles_path" + # + # form_for(MyEngine::Article.new) do + # text_field :title #=> + # end + # + # # Additionaly namespaced engine will set its name according to namespace, so in that case: - # MyEngine::Engine.engine_name #=> "my_engine" - # and it will set MyEngine.table_name_prefix to "my_engine_" + # MyEngine::Engine.engine_name #=> "my_engine" and it will set MyEngine.table_name_prefix + # to "my_engine_". # # == Using Engine's routes outside Engine # -- cgit v1.2.3