現在改訂4版基礎RUBY ON RAILSのchapter10をやっているのですが、著書通りにしているはずなのにエラーが出てしまいます。
##エラー内容
undefined method `entries_path' for #<#<Class:0x00007fbcce3ad788>:0x00007fbcce5ff8d8>
Rendered shared/_header.html.erb (Duration: 139.1ms | Allocations: 89325) Completed 500 Internal Server Error in 153ms (ActiveRecord: 0.6ms | Allocations: 99535) ActionView::Template::Error (undefined method `entries_path' for #<#<Class:0x00007fbcce3ad788>:0x00007fbcce5ff8d8>): 11: <ul> 12: <%= menu_link_to 'TOP', :root%> 13: <%= menu_link_to '投稿', :articles %> 14: <%= menu_link_to 'ブログ', :entries %> 15: <% if current_member%> 16: <%= menu_link_to '会員名簿', :members%> 17: <%= menu_link_to '管理ページ', :members%> app/helpers/application_helper.rb:9:in `block in menu_link_to' app/helpers/application_helper.rb:8:in `menu_link_to' app/views/shared/_header.html.erb:14 app/views/layouts/application.html.erb:15
該当箇所
<%= menu_link_to 'ブログ', :entries %>
module ApplicationHelper def page_title title = "Wakatta" title = @page_title + "-" + title if @page_title title end def menu_link_to(text, path, options = {}) content_tag :li do condition = options[:method] || !current_page?(path) link_to_if(condition, text, path, options) do content_tag(:span, text) end end end end
rails routes
Prefix Verb URI Pattern Controller#Action entries_index GET /entries/index(.:format) entries#index entries_show GET /entries/show(.:format) entries#show entries_new GET /entries/new(.:format) entries#new entries_edit GET /entries/edit(.:format) entries#edit passwords_edit GET /passwords/edit(.:format) passwords#edit accounts_show GET /accounts/show(.:format) accounts#show accounts_edit GET /accounts/edit(.:format) accounts#edit top_index GET /top/index(.:format) top#index search_members GET /members/search(.:format) members#search member_entries GET /members/:member_id/entries(.:format) entries#index members GET /members(.:format) members#index POST /members(.:format) members#create new_member GET /members/new(.:format) members#new edit_member GET /members/:id/edit(.:format) members#edit member GET /members/:id(.:format) members#show PATCH /members/:id(.:format) members#update PUT /members/:id(.:format) members#update DELETE /members/:id(.:format) members#destroy root GET / top#index about GET /about(.:format) top#about session DELETE /session(.:format) sessions#destroy POST /session(.:format) sessions#create edit_account GET /account/edit(.:format) accounts#edit account GET /account(.:format) accounts#show PATCH /account(.:format) accounts#update PUT /account(.:format) accounts#update edit_password GET /password/edit(.:format) passwords#edit password GET /password(.:format) passwords#show PATCH /password(.:format) passwords#update PUT /password(.:format) passwords#update articles GET /articles(.:format) articles#index POST /articles(.:format) articles#create new_article GET /articles/new(.:format) articles#new edit_article GET /articles/:id/edit(.:format) articles#edit article GET /articles/:id(.:format) articles#show PATCH /articles/:id(.:format) articles#update PUT /articles/:id(.:format) articles#update DELETE /articles/:id(.:format) articles#destroy
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2019/12/17 04:55
退会済みユーザー
2019/12/17 05:09
2019/12/17 05:38
退会済みユーザー
2019/12/17 05:48
2019/12/17 05:49
2019/12/17 08:43