0

私は本の第 4 版を扱っており、確認メールの送信部分は完了していますが、テストのためにブラウザーを使用しているときに、注文を行うときに問題が発生します..この本で (図 12.2: チェックアウト画面) )

Orders#create の ActionView::MissingTemplate c:/Sites/final/app/views/notifier/order_received.text.erb を表示すると、7 行目が発生します。

{:locale=>[:en]、:formats=>[:text]、:handlers=>[:erb、:builder、:jbuilder、:coffee]} で部分的な line_items/line_item が欠落しています。検索場所: * "c:/Sites/final/app/views"

抽出されたソース (7 行目あたり):

4: 
5: You ordered the following items:
6: 
7: <%= render @order.line_items %> 
8:
9: We'll send you a separate e-mail when your order ships.

Rails.root: c:/Sites/final

アプリケーション トレース | フレームワーク トレース | 完全なトレース app/views/notifier/order_received.text.erb:7:in _app_views_notifier_order_received_text_erb___555088091_31657836' app/mailers/notifier.rb:12:inorder_received' app/controllers/orders_controller.rb:58:in block in create' app/controllers/ orders_controller.rb:54:increate'

何か案は???

4

2 に答える 2

1

作成アクションの注文ビュー テンプレートがありません。しかし、ビューのテンプレートはおそらく必要ありません。おそらく、成功または失敗に応じて、別のアクションにリダイレクトしたいでしょう。何かのようなもの:

def create
  @person = Person.new(params[:person])
  if @person.save
    redirect_to @person, :notice => 'You successfully created person'
  else
    render :new
  end
end
于 2012-07-03T18:43:07.227 に答える
0

問題は <%= render @order.line_items %> にあります! 私はそれを削除し、完璧に機能し、メールを受信して​​います!

于 2012-07-04T08:18:25.310 に答える