Devise within namespace

后端 未结 6 733
慢半拍i
慢半拍i 2021-01-30 03:22

I\'m trying to split my rails project in a front-end for regular users and a back-end for admins. Therefore i have created a namespace \'admin\' so that i can easily control adm

6条回答
  •  别那么骄傲
    2021-01-30 03:43

    Both Jack Chu and iain solutions should solve the problem plus generating your views in order to customize the layout of the login form.

    So in your config/routes.rb you should have

    scope '/subfolder' do
       devise_for :admins, :controllers => { :sessions => "subfolder/sessions" }
    end
    
    namespace :subfolder do
      match '/', :to => 'subcontroller#action'
    end
    

    Remember di create your own controllers for sessions as you are already doing. Probably you will need to generate your views, too by using rails generate devise:views

    Check this for any doubt on devise tasks.

提交回复
热议问题