Rails.application.routes.draw do |map| match 'login' => 'user_sessions#new' match 'logout' => 'user_sessions#destroy' match 'signup' => 'users#new' #match 'sitemap(.:format)' => 'pages#sitemap' resources :users resource :user_session match "/:year/:month/:day/:id" => "sb/posts#show", :constraints => { :year => /\d{4}/, :month => /\d{2}/, :day => /\d{2}/ } match "/:year(/:month(/:day))" => "sb/posts#index", :constraints => { :year => /\d{4}/, :month => /\d{2}/, :day => /\d{2}/ } match "/tag/:id" => 'sb/posts#tag' match 'admin' => 'sb/admin/posts#index' namespace :sb do resources :posts namespace :admin do resources :posts do get :publish, :on => :member end end end root :to => "sb/posts#index" end