Spina CMS路由设置默认登录页面

时间:2020-02-10 02:41:17

标签: ruby-on-rails routes url-routing spina-cms

我有一个使用Spina CMS

的Rails应用程序

我希望登录页面\是admin中的页面之一。

例如localhost:3000\home是我的localhost:3000

当前获得404设置root :to => 'pages#home'

似乎root :to ...被Spina路由覆盖 enter image description here

routes.rb

Rails.application.routes.draw do

  match '(*any)', to: redirect(subdomain: ''), via: :all, constraints: {subdomain: 'www'}

  mount Spina::Engine => '/'

  root :to => 'pages#home' # => not working...

  get '/*id' => 'pages#show', as: "page", controller: 'pages', constraints: lambda { |request|
    !(request.env['PATH_INFO'].starts_with?('/rails/') || request.env['PATH_INFO'].starts_with?("/#{Spina.config.backend_path}") || request.env['PATH_INFO'].starts_with?('/attachments/'))
   }
end

1 个答案:

答案 0 :(得分:0)

在路线页面中,将root :to => 'pages#home'替换为root 'pages#home' 并添加

 resources :pages

让我知道这是否适合您:)