3

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
Trip
  • 26,756
  • 46
  • 158
  • 277

1 Answers1

1

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.

etagwerker
  • 523
  • 4
  • 15
  • It should be one of the symbols mentioned here: [Debugging Rails](http://guides.rubyonrails.org/debugging_rails_applications.html) – etagwerker Feb 23 '11 at 16:05