Created
August 3, 2010 13:40
-
-
Save teamon/506390 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# my_engine/lib/engine.rb | |
require "my_engine" | |
require "rails" | |
module MyEngine | |
class Engine < Rails::Engine | |
end | |
module Routes | |
def self.draw(map) | |
map.instance_exec do | |
match "/my_engine", :to => "my_engine#foo" | |
end | |
end | |
end | |
end | |
# my_app/config/routes.rb | |
MyApp::Application.routes.draw do | |
MyEngine::Routes.draw(self) | |
end | |
# $ rake routes | |
my_engine /my_engine {:controller=>"my_engine", :action=>"foo"} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# my_engine/lib/engine.rb | |
require "my_engine" | |
require "rails" | |
module MyEngine | |
class Engine < Rails::Engine | |
end | |
module Routes | |
def self.draw(map) | |
map.instance_exec do | |
match "/my_engine", :to => "my_engine#foo" | |
end | |
end | |
end | |
end | |
# my_app/config/routes.rb | |
MyApp::Application.routes.draw do | |
scope "bar" do | |
MyEngine::Routes.draw(self) | |
end | |
end | |
# $ rake routes | |
bar_my_engine /bar/my_engine {:controller=>"my_engine", :action=>"foo"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# my_engine/lib/engine.rb | |
require "my_engine" | |
require "rails" | |
module MyEngine | |
class Engine < Rails::Engine | |
end | |
module Routes | |
def self.draw(map) | |
map.instance_exec do | |
scope "baz" do | |
match "/my_engine", :to => "my_engine#foo" | |
end | |
end | |
end | |
end | |
end | |
# my_app/config/routes.rb | |
MyApp::Application.routes.draw do | |
scope "bar" do | |
MyEngine::Routes.draw(self) | |
end | |
end | |
# $ rake routes | |
bar_baz_my_engine /bar/baz/my_engine {:controller=>"my_engine", :action=>"foo"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment