Skip to content

Fix code reloading issues with IssueFinder::Params

Stan Hu requested to merge sh-improve-autoreload-issues-finder into master

Previously if IssueFinder::Params were reloaded during development, it would load a blank IssueFinder finder, which then fell back to the inherited IssuableFinder#params_class. This caused IssuableFinder::Params to be instantiated instead of IssuesFinder::Params, resulting in an error:

ActionView::Template::Error - undefined method `iterations' for {"assignee_id"=>1, "state"=>"opened", "non_archived"=>true}:IssuableFinder::Params:

Since IssuableFinder::Params doesn't define an iterations method, this caused a 500 error in development mode. However, this isn't a problem in production mode because everything is eager loaded.

It appears the easiest way to fix this issue is to rename:

  1. IssuableFinder::Params => IssuableFinderParams
  2. IssuesFinder::Params => IssuesFinderParams

If IssuesFinder or IssuableFinder needs to be reloaded, Rails will not assume the class has already be defined and will reload another file.

Edited by Stan Hu

Merge request reports