私は 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