gpt4 book ai didi

ruby-on-rails - 在 rails 4 中设计不显示登录表单

转载 作者:太空宇宙 更新时间:2023-11-03 16:45:50 25 4
gpt4 key购买 nike

我有 devise gem 的问题,我有这个 Controller 。

class AdminController < ApplicationController
before_action :authenticate_user!
def index
end

def per
end

def po
end
end

当重定向到登录表单时,什么都不显示

sign_in form

这些是我的路线:

  match 'po' => 'admin#po', :via => :get
match 'per' => 'admin#per', :via => :get
match 'admin' => 'admin#index', :via => :get
match 'admin/index' => 'admin#index', :via => :get
match 'admin/per' => 'admin#per', :via => :get
match 'admin/po' => 'admin#po', :via => :get
devise_for :users, :controllers => { :omniauth_callbacks => "callbacks" }
root 'home#index'

我有三个模板:application、admin 和 home我登录后覆盖默认路由

class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
#before_action :authenticate_user!
def after_sign_in_path_for(resource)
#request.env['omniauth.origin'] || stored_location_for(resource) || admin_path
admin_path
end
end

我最后安装的 gem:

gem 'bootstrap-sass'

最佳答案

您需要为 Devise View 运行生成器,它将在您的 views 文件夹中复制必要的文件:

运行:

rails g devise:views

有关配置设计 View 的更多信息 here

关于ruby-on-rails - 在 rails 4 中设计不显示登录表单,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33054919/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com