I want to be able to transition pages from users/index to users/showError message
Applicable source code
ActiveRecord :: RecordNotFound in UsersController # show Couldn't find User with 'id' = #<User :: ActiveRecord_Relation: 0x00007f8292d25ef8>
Recommended setting <% = link_to "See the recommendation", user_path (@user)%> <% = link_to "Determine the guess", new_user_path%>
class UsersController</pre> <pre><code data-language = "routes">Rails.application.routes.draw do devise_for: users resources: users # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html resources: posts, only: [: index] resources: comments, only: [: index,: new,: create,: show,: destory,: edit] do resources: likes, only: [: create,: destroy] end resources: favorites, only: [: create,: destroy,: edit,: update] root to: 'posts # index' end
When you check params by doing binding.pry at the show action of controller
Since id was "#
I don't think I can get it well, but I don't know where to fix it.
It was confirmed that the page can be transitioned if id is directly entered from users/index into url.
I don't know if you have the necessary files, but thank you.
Answer # 1
@user = User.all If multiple users are imported, the value is not an instance of User, but a model called Relation.
Also, Rails should be more sensitive to singular plurals. Let's be users.
@users = User.all
As for view, please take it out one by one.
<% @ users.each do | user |%> # Display various users <% = link_to "See the recommendation", user_path (user)%>
It is a feeling.
- html - the true identity of the mysterious blank that cannot be converted to escape characters
- html - the image cannot be uploaded on the edit page
- java - cannot pass data (screen transition) using servlet
- html - css z-index cannot be set properly
- html - i don't know how to resolve uncaught typeerror: cannot read property'length' of undefined
- html - cannot exclude margin element
- html - cannot adjust the size of table td tag
- you cannot pass a relative path in the html file of the a tag of html
- html - data cannot be acquired when using firebase (firestore) with wkwebview in monaca
- html - in line, a line break cannot be made in a text message using https://lineme/r/msg/text/?
- xcode - cannot transition with collectionview, didselectitemat use segement slide
- html - fontawesome cannot be read from css
- html - i want to display the user name on the product detail page
- html - cannot read resscss
- html - wordpress sidebar ruins cannot be erased (in lionblog)
- cannot link to "another html file in the same folder" in list view
- html - float cannot be set
- android - cannot use statafluwidget at the transition destination of flutter screen
- html - cannot scroll the page
- html - a shimanami font cannot be used (font-family)
- html - i want to paste the correct link with rails6 auto_link
- html is not displayed
- html - i want to display the name of the user who clicked the like next to the like function in the post list! !!
- html - accordion panel doesn't work well [ruby on rails]
- html - the display of the css body part is displayed over the header part! (i can't see through)
- html - i want to move to the daily page of the calendar
- html - i want to go to each user's detail page
- html - i want to go to the details page for each protocol when i am not logged in