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 - cannot center the entire page
- java - cannot pass data (screen transition) using servlet
- html - in jquery, values cannot be assigned to elements such as nested classes and ids
- html - isara copy reference hp cannot be laid out
- html - background cannot be displayed background-image
- html - data cannot be saved in the database
- html - svg font embedding, height and width cannot be specified
- html - image cannot be displayed with relative path
- html - cannot switch tab menu
- html - fontawesome cannot be read from css
- html - cannot center links
- html - css z-index cannot be set properly
- html - data cannot be acquired or displayed with parameters
- 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/?
- html - the image cannot be uploaded on the edit page
- html - i want to set the conditions to be displayed in collection_check_boxes
- html - i would like to know how to calculate the average of the data
- ruby - passing variables using render partial
- ruby - i want to display the title information of the article acquired by scraping with the index action
- ruby - syntax error, unexpected cannot be solved [rails]
- ruby - how to create multiple html with each by making two parts into individual data in the partial
- ruby - how to get a set of key and value randomly from hash with rails and use it in view