gpt4 book ai didi

ruby-on-rails - Ruby on Rails - 当我非常确定我有模板时缺少模板错误

转载 作者:太空宇宙 更新时间:2023-11-03 18:26:28 28 4
gpt4 key购买 nike

我有这条路线:

scope :module => :mobile, :as => :mobile do
constraints(:subdomain => /m/) do
devise_for :users, :path => "", :path_names =>
{ :sign_in => "login", :sign_out => "logout",
:sign_up => "signup" },
:controllers => {:sessions => "mobile/sessions"}

resources :home

resources :disclosures # Will have new, get, look up a disclosure
end
end

和这个 Controller :

class Mobile::SessionsController < ApplicationController
def create
end
end

并且在这个目录下:/app/views/mobile/sessions/new.html.haml

这是 new.html.haml 文件中的代码:

= content_for :page_title do
= t :page_title_login
= content_for :primary_content do
#login_box
.span6
#traditional-login
.span4
= content_for :before_closing_body_tag do
configure_login_form(#{request.xhr?.to_s.downcase});

但是在我登录后,我在浏览器中得到这个错误:

Missing template mobile/sessions/create, application/create with {:locale=>[:en, :en], :formats=>[:html], :handlers=>[:haml, :erb, :builder]}. Searched in: * "/Users/alexgenadinik/projects/cmply/cmply-app/app/views" * "/Library/Ruby/Gems/1.8/gems/ckeditor-3.6.3/app/views" * "/Library/Ruby/Gems/1.8/gems/kaminari-0.13.0/app/views" * "/Library/Ruby/Gems/1.8/gems/devise-2.0.4/app/views"

这向我暗示系统认为我没有 new.html.haml 文件。但我显然有那个文件。所以我不确定是什么问题。知道我做错了什么吗?

提前致谢!

最佳答案

这里的错误不是因为您缺少 new.html.haml 文件;而是因为您缺少 new.html.haml 文件;您缺少 create.html.haml 或创建操作之外的重定向。通常你在登录后重定向,所以尝试将你的 Controller 操作更改为如下所示:

class Mobile::SessionsController < ApplicationController
def create
redirect_to root_url
end
end

或者您希望访客结束的任何地方。

关于ruby-on-rails - Ruby on Rails - 当我非常确定我有模板时缺少模板错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10210956/

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