5

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

HungryCoder
  • 7,506
  • 1
  • 38
  • 51
  • Where is the method `find_script_name` located? Is it in the `application_controller.rb` or something? Have you recently also added any new gems or anything? – Rockwell Rice Dec 20 '20 at 18:54
  • it's in rails core (actionpack) as I linked in original post! i am seeing this after trying to upgrade to rails 6.1! – HungryCoder Dec 20 '20 at 23:00
  • @HungryCoder just ran into the same problem. Did you find a solution? Seems to be somehow related to path helpers used in views. – user1727870 May 11 '21 at 04:58
  • I have switched back to `6.0.4.1` and I got rid of this problem and a few other problems – dariush Nov 02 '21 at 09:25

1 Answers1

3

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

user1727870
  • 121
  • 7