所以我現在搜索了一段時間的表單,到目前爲止,我嘗試過的很多修復都讓我失望了一個兔子洞。這就是說,我試圖看看我剛剛創建的故事,但是當我去看看它時,我得到錯誤 「ActiveRecord :: RecordNotFound(找不到與'id'=」namegoeshere「的故事) 」。ActiveRecord :: RecordNotFound(找不到'id'=「namegoeshere」的故事)
然後,它指向我stories_controller爲「秀」
def show
@story = Story.find(params[:id])
@responses = @story.responses.includes(:user)
@related_stories = @story.related_stories
if request.path != story_path(@story)
redirect_to @story, status: 301
end
end
我不清楚什麼可以發生在這裏,因爲我認爲
@story = Story.find(params[:id])
將列出所有的故事。這裏是我的路線
resources :users, only: [:show, :edit, :update] do
resources :recommended_stories, only: [:index]
end
resources :stories, except: [:index] do
resources :responses, only: [:create]
end
在此show.html.erb文件
<div class="sidebar-top-stories">
<ul>
<% @dashboard.top_articles.each_with_index do |story, index| %>
<li class="top-articles-list-item">
<div class="count-button-wrapper">
<span class="count-button"><%= index + 1 %></span>
</div>
<div class="top-articles-links">
<%= link_to story.title, story, class: 'story-title' %><br/>
<small>
<%= react_component("PopoverLink", { user_id: story.user.id, url: user_path(story.user), children: story.username }) %>
</small>
</div>
</li>
<% end %>
</ul>
</div>
在模特的故事(&的部分
extend FriendlyId
friendly_id :title, use: [ :slugged, :history, :finders ]
這是日誌CMD Story.find_each :save) logs
Solv有些幫助感謝這種困境將不勝感激。
如果需要了解更多信息,請告訴我。
您使用什麼URL訪問故事頁面? –
我在哪裏查看視圖的鏈接點可能不正確。你可以發佈該鏈接的視圖的相關部分嗎? – SteveTurczyn
添加了我點擊@SteveTurczyn的視圖 –