I got an error when trying to display the details page of what I posted.
In rails routes, it was prototype_path, so it should be correct.
Corresponding source code
ActionController :: UrlGenerationError in Prototypes # index
show.html.erb<main> <p> <% = "Prototype title"%> </p> <% = link_to "by prototype contributor", root_path, class:: prototype__user%> <% # Display the following if the poster of the prototype and the logged-in user are the same%> <% if user_signed_in?&¤t_user.id == prototype.user_id%> <% = link_to "edit", edit_prototype_path, class:: prototype__btn%> <% = link_to "Delete", root_path, method:: delete, class:: prototype__btn%> <% end%> <% # // Show the above if the prototype poster and the logged-in user are the same%> <% = image_tag.prototype.image, class :: card__img%> <p>Catch copy</p> <p> <% = "Catch copy of prototype"%> </p> <p>Concept</p> <p> <% = "Prototype concept"%> </p> <% # Display the following comment posting form for logged-in users%> <% = form_with local: true do | f |%> <% = f.label: concept, "comment"%><br /> <% = f.text_field: concept%> <% = f.submit "submit", class :: form__btn%> <% end%> <% # // Show the above to logged-in users%> <ul> <% # Describe the process of listing the comments associated with the post%> <li> <% = "Comment text"%> <% = link_to "(user name)", root_path, class:: comment_user%> </li> <% # // Describe the process to list the comments associated with the post%> </ul> </main>
What I tried
prototypes_controller.rb class PrototypesController
I tried to display the details of the posted content, but I got an ActionController :: UrlGenerationError.
In the rails routes command, the detail page is prototype_path, but I still get an error.
Please provide more detailed information here.
Answer # 1
_prototype.html.rb prototype_path ↓ prototype_path (prototype.id)
When I changed it to, the details page was displayed.
Answer # 2
Probably because I haven't seen the actual routing,
prototype_path (params [: id]) Or edit_prototype_path (params [: id])
I think it will be.
I think that the target id of show or edit is included in params.
How is it?
- ruby on rails - i want to save the purchase information in the db
- ruby on rails - i want to move to the product purchase page
- ruby on rails - i want to display "sold out" when the product is sold
- ruby on rails - [rails] how to round (omission and display) the character string of link_to
- ruby on rails - i want to display the posted image in the background using image_tag or url_for
- ruby on rails - i want to display the latest posting date and time by creating a simple bulletin board
- html - i want to display the icon
- html - i want to display the hamburger menu even on the ipad display
- ruby on rails - [rails beginner] i want to display the posted content on my page
- ruby on rails - i want to eliminate nomethoderror
- ruby - dynamically display rails select box choices
- ruby on rails 6 - time display on rails
- html - i want to display the facebook icon
- ruby on rails - i want to erase www on heroku
- ruby on rails - i want to add a class to link_to
- ruby on rails - i want to save data in an intermediate table
- ruby on rails - i want to display search results
- ruby on rails 6 - use the local wsdl file in the soap client
- python - you may need to restart the kernel to use updated packages error
- php - coincheck api authentication doesn't work
- php - i would like to introduce the coincheck api so that i can make payments with bitcoin on my ec site
- [php] i want to get account information using coincheck api
- the emulator process for avd pixel_2_api_29 was killed occurred when the android studio emulator was started, so i would like to
- python 3x - typeerror: 'method' object is not subscriptable
- i want to call a child component method from a parent in vuejs
- dart - flutter: the instance member'stars' can't be accessed in an initializer error
- xcode - pod install [!] no `podfile 'found in the project directory