[RUBY] [Rails] Couldn't find with'id'=: id does not execute update action

Solution

It disappears when @ is deleted

Before correction def update @gear = find_gear_by_id @gear.update(gear_params) redirect_to gears_path flash [: notice] = "Editing completed" end ⇓ Revised def update gear = find_gear_by_id gear.update(gear_params) redirect_to gears_path flash [: notice] = "Editing completed" end

I don't know the detailed reason. .. ..

Recommended Posts

[Rails] Couldn't find with'id'=: id does not execute update action
[Ruby on Rails] When parameter id acquisition does not work
Rails6 Couldn't find User with'id' = sign_out and cannot log out
[Rails] Video does not play with video_tag
JavaScript (vanilla) does not respond in Rails.