我克隆并调整了这个Rails 应用程序,在 ajax 请求时渲染部分内容时遇到了一些麻烦,在日志中我看到有罪的行在registrations_controller.rb(设计)中
class RegistrationsController < Devise::RegistrationsController
def create
build_resource
if resource.save
if resource.active_for_authentication?
sign_in(resource_name, resource)
(render(:partial => 'thankyou', :layout => false) && return) if request.xhr?
respond_with resource, :location => after_sign_up_path_for(resource)
else
resource.update_attribute(:encrypted_password, nil) # make sure there is no password
expire_session_data_after_sign_in!
(render(:partial => 'thankyou', :layout => false) && return) if request.xhr?
respond_with resource, :location => after_inactive_sign_up_path_for(resource)
end
else
clean_up_passwords resource
render :partial => 'email_capture', :action => :new, :layout => !request.xhr?**
end
end
protected
def after_inactive_sign_up_path_for(resource)
'/thankyou.html'
end
def after_sign_up_path_for(resource)
redirect_to root_path
end
end
返回的错误信息是这样的:
ActionView::MissingTemplate - 缺少部分
使用 {:locale=>[:en], :formats=>[:html], :handlers=>[:erb, :builder, :coffee, :haml]}。在以下位置搜索:*“/Users/Davide/Documents/Jobsite/rails-prelaunch-signup-1click/app/views”*“/Users/Davide/.rbenv/versions/1.9.3-p194/lib/ruby/gems/ 1.9.1/gems/devise_invitable-1.1.8/app/views" * "/Users/Davide/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/devise-2.2。 4/应用程序/视图”
有趣的是,如果我删除 :layout => !=request.xhr? 参数部分被找到,但页面刷新并且丢失了所有样式表和其他资产。
知道我应该从哪里开始寻找吗?
谢谢!