Automatic route match for home and admin

I am trying to avoid having to type each controller path manually and
use the match as in here: ‘:controller(/:action(/:id))(.:format)’. So I
commented out all the manually routes and uncommented the match rule
down at the bottom of routes.rb.

It works for home controllers, but not the ones located at the admin

I tried modifying the match rule to include the “admin” path, but with
no success:

I keep getting this error:
No route matches [GET] “/admin/shop_services_configurator/index”

Look what I am trying to do:
match ‘/admin/:controller(/:action(/:id))(.:format)’

My goal is to have just two rules: one for home and one for admin.

Is it possible?

Kopy::Application.routes.draw do

home area

get “home/index”

get “my_account/index”

get “users/edit”

get “users/update”

put “users/update”

get “addresses/list”

get “addresses/edit”

get “addresses/delete”

put “addresses/update”

admin area

get “admin/shop_services_configurator/index”

post “admin/shop_services_configurator/create”

post “admin/shop_services_configurator/update”

#get “admin/shop_services_configurator/create”

get “admin/my_account/index”

post “admin/shop_users/create”

get “admin/shop_users/new”

post “admin/shop_users/new”

get “admin/shop_users/create”

get “admin/shop_services/create”

get “admin/shop_services/list”

post “admin/shop_services/list”

post “admin/shop_services/create”

get “shop_users/new”

get “shops/list”

post “shop_users/create”

get “greetings/hello”

post “admin/users/create”

get “admin/users/list”

get “admin/users/show”

get “admin/users/edit”

post “admin/users/edit”

get “admin/users/delete”

post “admin/users/delete”

put “admin/users/update”

get “admin/users/new”

post “admin/users/new”

get “admin/home/index”

get “categories/index”

get “categories/list”

get “access/login”

get “access/clear”

post “access/attempt_login”

get “admin/shops/edit”

get “admin/shops/update”

put “admin/shops/update”

get “javascripts/dynamic_states”

get “javascripts/index”

get “admin/discounts/index”

get “admin/selected_services/list”

root to: ‘home#index’

The priority is based upon order of creation:

first created -> highest priority.

Sample of regular route:

match ‘products/:id’ => ‘catalog#view’

Keep in mind you can assign values other than :controller and


Sample of named route:

match ‘products/:id/purchase’ => ‘catalog#purchase’, :as =>


This route can be invoked with purchase_url(:id =>

Sample resource route (maps HTTP verbs to controller actions


resources :products

Sample resource route with options:

resources :products do

member do

get ‘short’

post ‘toggle’


collection do

get ‘sold’



Sample resource route with sub-resources:

resources :products do

resources :comments, :sales

resource :seller


Sample resource route with more complex sub-resources

resources :products do

resources :comments

resources :sales do

get ‘recent’, :on => :collection



Sample resource route within a namespace:

namespace :admin do

# Directs /admin/products/* to Admin::ProductsController

# (app/controllers/admin/products_controller.rb)

resources :products


You can have the root of your site routed with “root”

just remember to delete public/index.html.

root :to => ‘welcome#index’

See how all your routes lay out with “rake routes”

This is a legacy wild controller route that’s not recommended for

RESTful applications.

Note: This route will make all actions in every controller

accessible via GET requests.

namespace “admin” do
resources :shop_services_configurator_controller, :users

match ‘:controller(/:action(/:id))(.:format)’