How to have multiple paths display URL as root

Posted by Verdi Erel Ergün on Stack Overflow See other posts from Stack Overflow or by Verdi Erel Ergün
Published on 2012-03-26T22:31:10Z Indexed on 2012/03/26 23:29 UTC
Read the original article Hit count: 280

Filed under:

I want users#new and tasks#index to display as the root path URL, i.e. / When a user logs in on the path users#new (set as root) they are redirected to tasks#index and URL does not change. Can this be done in the routes.rb file?

This is my routes.rb file:

Todo::Application.routes.draw do
  resources :sessions 
  resources :subscriptions
  resources :users
  resources :tasks do
    collection do
      post :sort
    end
  end
  root :to => "users#new"
  match "sessions#new" => "tasks#index"
  match "sessions#" => "tasks#index"

© Stack Overflow or respective owner

Related posts about ruby-on-rails