Skip to content
This repository
Browse code

List all of isolated engine changes

Signed-off-by: José Valim <jose.valim@gmail.com>
  • Loading branch information...
commit 07411ca4907ec32d9c23619390cf50c7c0c1af07 1 parent 83ecd03
Piotr Sarnacki authored September 20, 2010 josevalim committed September 20, 2010

Showing 1 changed file with 21 additions and 3 deletions. Show diff stats Hide diff stats

  1. 24  railties/lib/rails/engine.rb
24  railties/lib/rails/engine.rb
@@ -211,12 +211,30 @@ module Rails
211 211
   #     end
212 212
   #   end
213 213
   #
214  
-  # If engine is marked as namespaced, FooController has access only to helpers from engine and
  214
+  # If engine is marked as isolated, FooController has access only to helpers from engine and
215 215
   # url_helpers from MyEngine::Engine.routes.
216 216
   #
  217
+  # The next thing that changes in isolated engine is routes behaviour. Normally, when you namespace
  218
+  # your controllers, you need to use scope or namespace method in routes. With isolated engine,
  219
+  # the namespace is applied by default, so you can ignore it in routes. Further more, you don't need
  220
+  # to use longer url helpers like "my_engine_articles_path". As the prefix is not set you can just use
  221
+  # articles_path as you would normally do.
  222
+  #
  223
+  # To make that behaviour consistent with other parts of framework, isolated engine has influence also on
  224
+  # ActiveModel::Naming. When you use namespaced model, like MyEngine::Article, it will normally
  225
+  # use the prefix "my_engine". In isolated engine, the prefix will be ommited in most of the places,
  226
+  # like url helpers or form fields.
  227
+  #
  228
+  #   polymorphic_url(MyEngine::Article.new) #=> "articles_path"
  229
+  #
  230
+  #   form_for(MyEngine::Article.new) do
  231
+  #     text_field :title #=> <input type="text" name="article[title]" id="article_title" />
  232
+  #   end
  233
+  #
  234
+  #
217 235
   # Additionaly namespaced engine will set its name according to namespace, so in that case:
218  
-  # MyEngine::Engine.engine_name #=> "my_engine"
219  
-  # and it will set MyEngine.table_name_prefix to "my_engine_"
  236
+  # MyEngine::Engine.engine_name #=> "my_engine" and it will set MyEngine.table_name_prefix
  237
+  # to "my_engine_".
220 238
   #
221 239
   # == Using Engine's routes outside Engine
222 240
   #

0 notes on commit 07411ca

Please sign in to comment.
Something went wrong with that request. Please try again.