コードが正常に実行されるレールを使用してAJAXルーチンを実行しようとしていますが、応答がありません。
このエラーが発生します
テンプレートがありません
Missing template line_items/create, application/create with {:locale=>[:en], :formats=>[:js, :html], :handlers=>[:erb, :builder, :coffee]}. Searched in: * "D:/ruby/depot/app/views"
アジャイルWeb開発の本のようにline_itemsディレクトリ内にcreate.js.rjsを作成しましたが、エラーが発生します。
#file line_items_controller.rb
def create
@cart = current_cart
product = Product.find(params[:product_id])
@line_item = add_product(@cart, product.id)
respond_to do |format|
if @line_item.save
format.html { redirect_to store_url }
format.js
format.json { render json: @line_item, status: :created, location: @line_item }
#...
end
end
end
そして私のcreate.js.rjsの中で私はこれを手に入れました
page.replace_html('cart', render(@cart))