在我的問題How to have root view when user is not logged in rails? max答覆我們可以使用authenticated
使路由只有當有人被認證。我有一個probem,我怎麼可以構建這樣的:如何在使用Devise時構建認證路線?
Rails.application.routes.draw do
devise_for :users
authenticated :user do
# when authenticated allow all action on student
resources :subjects do
resources :students
end
end
# when not only allow read on student
resources :subjects do
resources :students, only: [:get]
end
root "home#index"
end
問題是我不想讓上:subjects
任何未經驗證的行動如何制止呢?