LoginSignup
28
28

More than 5 years have passed since last update.

Userがログインしている時としていない時でルーティングを変える【Rails + Devise】

Last updated at Posted at 2014-11-06
config/routes.rb
Rails.application.routes.draw do

  # Userログイン時
  authenticated :user do
    root :to => "dashboard#dashboard", :as => "user_authenticated_root"
  end

  # User非ログイン時
  root "top#index"

end

非ログインを示すunauthenticatedメソッドも用意されています。

Class: ActionDispatch::Routing::Mapper — Documentation for plataformatec/devise (master)

28
28
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
28
28