前提・実現したいこと
実現したいこと
リスト編集画面に遷移するリンクを追加したい
現在RailsでToDo管理アプリを勉強しながら作成しているがエラーが出てググっても解決方法が見つからないため原因を探るのと解決したい
発生している問題・エラーメッセージ
エラーメッセージ 一番最初に出たエラー NoMethodError in Top#index Showing /home/ec2-user/environment/toretodo/app/views/top/index.html.erb where line #8 raised: undefined method `edit_list_path' for #<#<Class:0x0000000003f6ef70>:0x0000000004ad5648> Did you mean? edit_registration_path と出たため、 <%= link_to(content_tag(:i, '', class: 'fas fa-pen'), edit_registration_path(list)) %> に変更してみたがエラーが出てしまった RuntimeError in Top#index Showing /home/ec2-user/environment/toretodo/app/views/top/index.html.erb where line #8 raised: Could not find a valid mapping for #<List id: 1, title: "寝る", user_id: 1, created_at: "2019-08-29 18:42:30", updated_at: "2019-08-29 18:42:30">
該当のソースコード
ruby
1ソースコード 2<div class="topPage"> 3 <div class="listWrapper"> 4 <% @lists.each do |list| %> 5 <div class="list"> 6 <div class="list_header"> 7 <h2 class="list_header_title"><%= list.title %></h2> 8 <div class="list_header_action"> 9 <%= link_to(content_tag(:i, '', class: 'fas fa-pen'), edit_list_path(list)) %> 10 </div> 11 </div> 12 </div> 13 <% end %> 14 </div> 15</div>
ruby
1routes.rb 2Rails.application.routes.draw do 3 devise_for :users 4 # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html 5 root 'top#index' 6 7 resources :list, only: %i(new create edit update) 8end 9 10
試したこと
<%= link_to(content_tag(:i, '', class: 'fas fa-pen'), edit_list_path(list)) %>
のedit_list_pathがダメなのかと思い、
edit_registration_pathに変更して実行した
ググってエラー名でググって調べてみた