开发者

undefined method `error' for true:TrueClass

开发者 https://www.devze.com 2023-02-09 19:30 出处:网络
I\'m using Spree, and setting up the spree_easy_contact extension. When I send an email, it sends correctly, and saves it to the database correctly, but I\'m redirected to an error screen :

I'm using Spree, and setting up the spree_easy_contact extension.

When I send an email, it sends correctly, and saves it to the database correctly, but I'm redirected to an error screen :

NoMethodError in ContactsController#create

undefined method `error' for true:TrueClass

It doesn't give any hints as to where this might be erring. Does anyone know what this error is caused by?

Here is the only thing left in my log :

NoMethodError (undefined method `error' for true:TrueClass):


Rendered /Library/Ruby/Gems/1.8/gems/actionpack-3.0.3/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.7ms)
Rendered /Library/Ruby/Gems/1.8/gems/actionpack-3.0.3/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (4980.8ms)
Rendered /Library/Ruby/Gems/1.8/gems/actionpack-3.0.3/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (5123.9ms)

This is from the Gem's contact_controller :

def create
  @contact = Co开发者_C百科ntact.new(params[:contact] || {})
  respond_to do |format|
    if @contact.valid? &&  @contact.save
      ContactMailer.message_email(@contact).deliver
      format.html { redirect_to(root_path, :notice => t("message_sended")) }
    else
      format.html { render :action => "new" }
    end
  end
end


It seems that the problem is in this line:

format.html { redirect_to(root_path, :notice => t("message_sended")) }

Can you increase logging to see where this error is happening?

Maybe you can set config.log_level = :debug to get more information.

0

精彩评论

暂无评论...
验证码 换一张
取 消