gpt4 book ai didi

ruby-on-rails - Rails语法错误

转载 作者:行者123 更新时间:2023-12-03 09:11:01 25 4
gpt4 key购买 nike

每当我启动Rails服务器时,都会出现以下错误:

SyntaxError - /Users/Bangner/Desktop/wednesday/myapp/vendor/bundle/gems/devise-3.1.0/app/controllers/devise/sessions_controller.rb:52: syntax error, unexpected keyword_end, expecting end-of-input:
zeus (0.13.3) lib/zeus/load_tracking.rb:50:in `'
zeus (0.13.3) lib/zeus/load_tracking.rb:50:in `load'
zeus (0.13.3) lib/zeus/load_tracking.rb:50:in `load'

我的 session Controller :
class Devise::SessionsController < DeviseController
prepend_before_filter :require_no_authentication, :only => [ :new, :create ]
prepend_before_filter :allow_params_authentication!, :only => :create
prepend_before_filter { request.env["devise.skip_timeout"] = true }

# GET /resource/sign_in
def new
self.resource = resource_class.new(sign_in_params)
clean_up_passwords(resource)
respond_with(resource, serialize_options(resource))
end
end

# POST /resource/sign_in
def create
self.resource = warden.authenticate!(auth_options)
set_flash_message(:notice, :signed_in) if is_navigational_format?
sign_in(resource_name, resource)
respond_with resource, :location => after_sign_in_path_for(resource)
end

# DELETE /resource/sign_out
def destroy
redirect_path = after_sign_out_path_for(resource_name)
signed_out = (Devise.sign_out_all_scopes ? sign_out : sign_out(resource_name))
set_flash_message :notice, :signed_out if signed_out && is_navigational_format?

# We actually need to hardcode this as Rails default responder doesn't
# support returning empty response on GET request
respond_to do |format|
format.all { head :no_content }
format.any(*navigational_formats) { redirect_to redirect_path }
end
end

protected

def sign_in_params
devise_parameter_sanitizer.sanitize(:sign_in)
end

def serialize_options(resource)
methods = resource_class.authentication_keys.dup
methods = methods.keys if methods.is_a?(Hash)
methods << :password if resource.respond_to?(:password)
{ :methods => methods, :only => [:password] }
end

def auth_options
{ :scope => resource_name, :recall => "#{controller_path}#new" }
end
end

最佳答案

在第11行,您有一个额外的end语句。

  def new
self.resource = resource_class.new(sign_in_params)
clean_up_passwords(resource)
respond_with(resource, serialize_options(resource))
end ### <--- this is the line that's causing your error
end

关于ruby-on-rails - Rails语法错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23397384/

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