Skip to content

Instantly share code, notes, and snippets.

@nesquena
Forked from DAddYE/Routing.rb
Created November 12, 2009 20:23
Show Gist options
  • Save nesquena/233245 to your computer and use it in GitHub Desktop.
Save nesquena/233245 to your computer and use it in GitHub Desktop.
namespace :admin do
get :show do
...
end
end
namespace :frontend do
get :index do
...
end
end
get :accounts do
...
end
map(:admin, :show).to("/my-admin/:id/show")
map(:frontend, :index).to("/")
map(:accounts).to("/show-me-my/accounts")
# or
map :admin do |namespace|
namespace.map(:show).to("/my-admin/:id/show")
end
# and to use
link_to "Show Admin", admin_show_path(:id => 5)
link_to "FrontEnd", frontend_index_path
link_to "Accounts", accounts_path
# or maybe
link_to "Show Admin", url_for(:admin, :show, :id => 5)
link_to "FrontEnd", url_for(:frontend)
link_to "Accounts", url_for(:accounts)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment