前提・実現したいこと
Ruby on Railsで簡単なshowアクションを作っています。
引数の数が正しくないという内容のエラーが出ますが、対処方法がわかりまん。
発生している問題・エラーメッセージ
wrong number of arguments (given 1, expected 2..4)
該当のソースコード
show.html.erb
<h3> 商品情報</h3> <div class="actions"> <p> <table> <tr> <th><%= label :ID %></th> <th><%= @product.id %></th> </tr> <tr> <th><%= label :商品コード %></th> <th><%= @product.code %></th> </tr> <tr> <th><%= label :商品名 %></th> <th><%= @product.name %></th> </tr> </table> </p> </div> <%= link_to 'Edit', edit_product_path(@product) %> | <%= link_to 'Back', products_path %>
index.html.erb
<td><%= link_to 'Show', product %></td>
controller
def show @product = Product.find(params[:id]) end
試したこと
エラーメッセージで検索
補足情報(FW/ツールのバージョンなど)
Rails 5.0.7.2
Ubuntu VERSION="16.04.6 LTS (Xenial Xerus)"
ruby 2.4.6p354
gem 2.6.14.4
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2019/07/17 06:47
2019/07/17 13:49