Home>

Why is it when I press the "Check operation" button with the following configuration?The action'show' could not be found for HogesControllerI get the error, but I don't know how to deal with it.

  • There is no show action on this controller in the first place
  • The routing partget'hoge2'If i set it to, it will jump to the hoge2 action without error and get caught in pry
  • (Because the show action is not necessary this time) The routing partresources: hoges, except: [: show] doIf i set it to, 404 will be returned.
  • The hoge2 action doesn't want to display the view, it's an action to handle within the action
# routes.rb
resources: hoges do
  collection do
    post'hoge2'
  end
end
# hoges_controller.rb
def index;end
...
def hoge2
  binding.pry
end
// index.html.haml
= link_to'Check operation', hoge2_hoges_path

If anyone knows the solution, please let me know.