Note that there are some explanatory texts on larger screens.

plurals
  1. POMaking the show page url at the site root after logging in
    primarykey
    data
    text
    <p>Currently, when a user logs in or signs up, they are redirected to /users/1, for example, as their show page.</p> <p>I can't figure out what routes to use to redirect them to just the site root (example.com, for example, instead of example.com/users/1). The logged in site root would be the show page, the logged out site root would be the normal site home page.</p> <p>I'm using devise, if it matters.</p> <p>Current routes:</p> <pre><code> devise_for :users, :path =&gt; '', :path_names =&gt; { :sign_in =&gt; 'login', :sign_out =&gt; 'logout', :password =&gt; 'password', :confirmation =&gt; 'verification', :unlock =&gt; 'unblock', :registration =&gt; 'signup', :sign_up =&gt; 'new' } devise_scope :user do get 'login', to: 'devise/sessions#new' get 'users/login', to: 'devise/sessions#new' get 'logout', to: 'devise/sessions#destroy' get 'signup', to: 'devise/registrations#new' get 'password', to: 'devise/passwords#new' match 'users/secret', to: "devise/passwords#create", via: :post match 'sessions/user', to: 'devise/sessions#create', via: :post match 'users/signup', to: 'devise/registrations#create', via: :post match 'users/signup', to: 'devise/registrations#create', via: :post end resources :users resources :sessions root 'site#index' </code></pre> <p>Updated Routes:</p> <pre><code> devise_for :users, :path =&gt; '', :path_names =&gt; { :sign_in =&gt; 'login', :sign_out =&gt; 'logout', :password =&gt; 'password', :confirmation =&gt; 'verification', :unlock =&gt; 'unblock', :registration =&gt; 'signup', :sign_up =&gt; 'new' } get 'login' =&gt; 'users/login' devise_scope :user do get 'login', to: 'devise/sessions#new' get 'users/login', to: 'devise/sessions#new' get 'logout', to: 'devise/sessions#destroy' get 'signup', to: 'devise/registrations#new' get 'password', to: 'devise/passwords#new' match 'users/secret', to: "devise/passwords#create", via: :post match 'sessions/user', to: 'devise/sessions#create', via: :post match 'users/signup', to: 'devise/registrations#create', via: :post match 'users/signup', to: 'devise/registrations#create', via: :post end get '', to: 'users#show', as: 'user' get 'edit', to: 'users#edit', as: 'user/edit' #resources :users resources :sessions # Authenticated Users: authenticated :user do root to: "users#show", as: :authenticated_root end # Non-Authenticated Users root to: 'site#index' </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload