-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Labels
Description
Read the "Isolated Engine" section on http://edgeapi.rubyonrails.org/classes/Rails/Engine.html
The next thing that changes in isolated engines is the behaviour of routes. Normally, when you namespace your controllers, you also need to do namespace all your routes. With an isolated engine, the namespace is applied by default, so you can ignore it in routes:MyEngine::Engine.routes.draw do resources :articles endThe routes above will automatically point to MyEngine::ApplicationContoller. Furthermore, you don’t need to use longer url helpers like my_engine_articles_path. Instead, you should simply use articles_path as you would do with your application.
To make that behaviour consistent with other parts of the framework, an isolated engine also has influence on ActiveModel::Naming. When you use a namespaced model, like MyEngine::Article, it will normally 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"