Home>
I put a link because I want to delete the posted content, but I get an error.
** index.html.haml **
.header
= render "header"
.wrapper
.right_box
.right_box_bar
[email protected] posts.each do | post |
.right_box_bar_name
= post.name
.right_box_bar_name_select
% ul.right_box_bar
% li
= link_to "Delete", post_path (@ post.id), method:: delete, class:'destoroy_btn'
% li
= link_to "edit", edit_post_path (@ post.id), class:'edit_btn'
Error statement
**the top screen
**. right_box_bar_name_select
% ul.right_box_bar
% li
= link_to "Delete", post_path (@ post.id), method:: delete, class:'destoroy_btn'
% li
= link_to "edit", edit_post_path (@ post.id), class:'edit_btn'
controller
def edit
@post = Post.find (params [: id])
end
def update
post = Post.find (params [: id])
post.update (post_params)
end
def destroy
post = Post.find (params [: id])
post.destroy
end
That's the situation.
From my point of view, I felt that there was a problem with how to write the path using prifix.
-
Answer # 1
Related articles
- ruby - i get a routing error when i delete
- ruby - i want to resolve an error when installing gem byebug
- ruby on rails - i get an error with rails db: create
- ruby - no error message is displayed during new registration
- ruby on rails - the latitude and longitude of the registered address is not converted by geocoding
- ruby - after new registration with devise, an error is displayed
- ruby - i don't know the cause of the validation error in factorybot
- ruby on rails - i don't understand the content of the error
- ruby on rails - i get an error in a program that changes over time
- error in building environment of ruby on rails
- ruby on rails - nomethoderror in itemscontroller # new error
- ruby - i got a routing error when i sent a comment
- ruby on rails - i get an error without being created
- ruby on rails 6 - when i press new user registration, i get an error of no route matches [get] "/ users"
- ruby - i entered secret_key_base, but http error 500 cannot be resolved
- ruby on rails - error when implementing rails6 follow function
- ruby - please tell me the cause of the error when specifying model: of form_with
- ruby - about error of update action when nesting
- ruby - an error occurred when implementing the micropost search function using ransack
Related questions
- ruby - passing variables using render partial
- ruby - deployment error on heroku
- ruby - output the total integer value held by each user
- ruby - i want to use the search method for active hash data
- ruby - destroy action does not respond
- ruby - how do you see the rails controller relative path? (carrierwave directory deleted)
- ruby - when deploying on capistrano, i get the error "access denied for user'ec2-user' @'localhost' (using password: no)&qu
- javascript - run multiple times with js + each do
- how to reflect the layout downloaded from the external site in ruby on rails?
- ruby - how nice! function routes do not pass well (relation) [rails]
post_path (@ post.id)
⇒post_path (post.id)