Rails route issue after upgrading to rails 6.1

1k views Asked by At

After upgrading to Rails 6.1, I'm getting following error:

undefined method `find_script_name' for nil:NilClass

In this case the route is being used is root_path but getting this for many other routes too! routes.rb is as following (tried like this after removing all other route definitions)

Rails.application.routes.draw do
  root 'home#index'
end

Only relevant thing I found online is this commit. Anyone has idea what could be wrong?

I'm running on ruby 2.7.2

1

There are 1 answers

0
user1727870 On

it looks like a bug in the current release of rails 6.1

https://github.com/rails/rails/issues/42218

the current fix is to prefix all path helper calls inside the views with:

Rails.application.routes.url_helpers.

so session_path becomes Rails.application.routes.url_helpers.session_path