amatsuda / traceroute

A Rake task gem that helps you find the unused routes and controller actions for your Rails 3+ app
MIT License
903 stars 38 forks source link

NameError: uninitialized constant ActionDispatch::Routing::PathRedirect #35

Closed MuneebSarfraz94 closed 4 years ago

MuneebSarfraz94 commented 6 years ago

When i run rake traceroute command in my application i get this error. ruby 2.1.10 NameError: uninitialized constant ActionDispatch::Routing::PathRedirect

amatsuda commented 6 years ago

@MuneebSarfraz94 Hmm. What's your Rails version?

MuneebSarfraz94 commented 6 years ago

rails v 3.2.13. I had to downgrade gem version to fix the issue. i tried every downgraded version till 0.5.0 but issue existed. Fixed at version 0.5.0.

amatsuda commented 6 years ago

Thanks, but the issue couldn't be reproduced on my side. Could you post a minimum routes.rb that reproduces the error?

irvingreid commented 4 years ago

The ActionDispatch::Routing::PathRedirect class was added to Rails in 4.0; see https://github.com/rails/rails/commit/ec774983514d4ce1b593585ae14a17b730ee2c46 and https://apidock.com/rails/v4.0.2/ActionDispatch/Routing/PathRedirect.

In our case, we're using a custom constraint like the one described here: https://guides.rubyonrails.org/v3.2.13/routing.html#advanced-constraints; I suspect that's part of the cause, though I haven't been able to build a failing test case yet.

amatsuda commented 4 years ago

@MuneebSarfraz94 @irvingreid Thank you for the hints! I guess I fixed this issue via e4b45c3e665a3403e65ebe15155898f8c5dfd8c6.

I'm not sure if I'd say we're still supporting Rails 3 though. I wrote this patch not because we still support Rails 3 but just because I could write the patch for this particular case.

If you're really maintaining an application on that legacy Rails, I recommend you to migrate to a newer supported version as soon as possible.

amatsuda commented 4 years ago

Just made a version 0.8.1 release with a fix for this issue. HTH

irvingreid commented 4 years ago

Thanks, that's great! I'm looking to use this gem as part of a "migrate off rails3" project :-)

amatsuda commented 4 years ago

Sounds great! Good luck on your project :)