Devise within namespace

后端 未结 6 559
慢半拍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

    If you want to put your devise views in views/admin/admins/ and your controllers in controllers/admin/admins/:

    your sessions_controller.rb in controllers/admin/admins:

    class Admin::Admins::SessionsController < ::Devise::SessionsController
      layout "admin/connection"
    end
    

    routes.rb :

    namespace :admin do |admin|
        devise_for :admins, :controllers => { :sessions => "admin/admins/sessions" }
    end
    

    Generating devise views :

    rails g devise:views admin/admins
    

提交回复
热议问题