3

私は Spree を使用しており、spree_easy_contact 拡張機能をセットアップしています。

メールを送信すると、正しく送信され、データベースに正しく保存されますが、エラー画面にリダイレクトされます:

NoMethodError in ContactsController#create

undefined method `error' for true:TrueClass

これがどこで間違っている可能性があるかについてのヒントはありません。このエラーの原因を知っている人はいますか?

これが私のログに残っている唯一のものです:

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)

これは Gem の 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
4

1 に答える 1

1

問題は次の行にあるようです。

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

このエラーが発生している場所を確認するためにログを増やすことはできますか?

config.log_level =:debugを設定して、より多くの情報を取得できるかもしれません。

于 2011-02-13T15:09:13.530 に答える