Rails Tutorial Chapter 13, 13.3.4 Delete Microposts does not work.
As a symptom, clicking on the Delete Micropost link takes you to the Home page, and the micropost that you clicked delete remains.
We have checked the debugs to see that @micropost
in the correct_user
method in micropost_controller.rb is nil, but the debug will return the replacement expression current_user.microposts.find_by (id:params[:id])
.If anyone has seen a similar phenomenon, I would appreciate it if you could give me some advice.
Sorry for the trouble.I was able to solve myself.
@micropost=current_user.microposts.find_by(id:params[:id]) The space on the left side of ) seems to have been full-width.
Sorry for the rudimentary mistake.
© 2023 OneMinuteCode. All rights reserved.