roadmap icon indicating copy to clipboard operation
roadmap copied to clipboard

500 Error When Using Language Selector Within Some URL Paths

Open aaronskiba opened this issue 1 year ago • 0 comments

Please complete the following fields as applicable:

What version of the DMPRoadmap code are you running? (e.g. v2.2.0)

  • v4.1.1

Steps to reproduce:

  • This bug appears to be related to the use of render :action_name within several of the codebase's controller actions.

e.g.

# app/controllers/contributors_controller.rb

  # PUT /plans/:plan_id/contributors/:id
  def update
    ...
      render :edit
    ...
  end

  # GET /plans/:plan_id/contributors/:id/edit
  def edit
    ...
  end

If render :edit is executed within the update action, then the edit view is rendered. However, the path remains on the /plans/:plan_id/contributors/:id PUT path.

From there, if we use the language selector, then the following code is executed:

  def update
    ...
    redirect_back(fallback_location: root_path)
  end

redirect_back seems to call the controller action that corresponds to the GET method for the current URL path. However, there is no controller action for GET /plans/:plan_id/contributors/:id within the codebase. As a result, the following error is rendered within development:

Screenshot from 2024-04-02 09-22-58

Throughout the codebase, there are controller actions that call render :x, without having a GET action corresponding to the current path that the app is on.

aaronskiba avatar Apr 02 '24 15:04 aaronskiba