Rails 7, annotate --routes failed
Opened this issue ยท 5 comments
SimBed commented
Thanks for the gem. I am just trying it out in Rails 7 after listening to an episode of the Ruby for All podcast where it is referred.
annotate --routes
rake aborted!
Don't know how to build task 'routes' (See the list of available tasks with `rake --tasks`)
This is due to the the rake routes
deprecation [need to use rails routes
instead]. An issue was raised earlier about the deprecation warning (just gave a warning, but continued to work in Rails 6.0). Now in 7.0 it fails.
Thanks Daniel
Ashley-King commented
A work-around that works for me: create a file in /lib/tasks called routes.rake and add this:
task routes: :environment do
puts `bundle exec rails routes`
end
AliOsm commented
I'm using devcontainers, I added this line in my setup.sh
script:
sudo sed -i 's/rake routes/rails routes/g' /usr/local/rvm/gems/ruby-3.2.2/gems/annotate-3.2.0/lib/annotate/annotate_routes/header_generator.rb
Sorry for the dirtiness :)
drwl commented
@ruanltbg Hi, I don't actively maintain this gem anymore, but work on https://github.com/drwl/annotaterb.
ruanltbg commented
Thank you, I will update my gemfile.