diff options
author | Piotr Sarnacki <drogus@gmail.com> | 2010-08-04 00:03:26 +0200 |
---|---|---|
committer | Piotr Sarnacki <drogus@gmail.com> | 2010-09-03 22:59:12 +0200 |
commit | 434139f89fd2ec550b8c5ab1309e5a8af06142d7 (patch) | |
tree | ae2d5006f01b97c3aba6cd9312946b0908f5f231 | |
parent | 1a161c75eda50d58fe2a9c5bf3aee947ed17f5ea (diff) | |
download | rails-434139f89fd2ec550b8c5ab1309e5a8af06142d7.tar.gz rails-434139f89fd2ec550b8c5ab1309e5a8af06142d7.tar.bz2 rails-434139f89fd2ec550b8c5ab1309e5a8af06142d7.zip |
Documented mounted helpers
-rw-r--r-- | railties/lib/rails/engine.rb | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/railties/lib/rails/engine.rb b/railties/lib/rails/engine.rb index 5b324663be..1b0ab07b11 100644 --- a/railties/lib/rails/engine.rb +++ b/railties/lib/rails/engine.rb @@ -208,6 +208,35 @@ module Rails # MyEngine::Engine.engine_name #=> "my_engine" # and it will set MyEngine.table_name_prefix to "my_engine_" # + # == Using Engine's routes outside Engine + # + # Since you can mount engine inside application's routes now, you do not have direct access to engine's + # url_helpers inside application. When you mount Engine in application's routes special helper is + # created to allow doing that. Consider such scenario: + # + # # APP/config/routes.rb + # MyApplication::Application.routes.draw do + # mount MyEngine::Engine => "/my_engine", :as => "my_engine" + # match "/foo" => "foo#index" + # end + # + # Now, you can use my_engine helper: + # + # class FooController < ApplicationController + # def index + # my_engine.root_url #=> /my_engine/ + # end + # end + # + # There is also 'app' helper that gives you access to application's routes inside Engine: + # + # module MyEngine + # class BarController + # app.foo_path #=> /foo + # end + # end + # + # Note that :as option takes engine_name as default, so most of the time you can ommit it. class Engine < Railtie autoload :Configurable, "rails/engine/configurable" autoload :Configuration, "rails/engine/configuration" |