Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

undefined method `error' for true:TrueClass

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 = Contact.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
like image 387
Trip Avatar asked Sep 19 '26 14:09

Trip


1 Answers

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.

like image 129
etagwerker Avatar answered Sep 21 '26 09:09

etagwerker



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!