I wanted to be able to automatically regenerate the sorbet-rails definition on changes to certain files. This works pretty well except for the above warning.
if Rails.env.development?
# Make sure that the sorbet-rails tasks are available to be called
Rails.application.load_tasks
rails_routes_reloader = ActiveSupport::FileUpdateChecker.new([Rails.root.join("config", "routes.rb")]) do
# For some reason, the reload can be invoked on the routes file changing but the routes haven't actually been
# loaded into Rails. This forces Rails to update it's definition of the routes so that sorbet-rails can see them.
Rails.application.reload_routes!
Rake::Task["rails_rbi:routes"].invoke
end
ActiveSupport::Reloader.to_prepare do
rails_routes_reloader.execute
end
end
This might be a user error on my part. Is there a different way to autogenerate the definitions on config/routes.rb change?
Describe the bug:
After running
Rails.application.load_tasks
, I'm seeing the followingon every call of
bin/rails rails_rbi:...
Steps to reproduce:
I wanted to be able to automatically regenerate the
sorbet-rails
definition on changes to certain files. This works pretty well except for the above warning.This might be a user error on my part. Is there a different way to autogenerate the definitions on
config/routes.rb
change?Can we change: https://github.com/chanzuckerberg/sorbet-rails/blob/master/lib/sorbet-rails/tasks/rails_rbi.rake#L9
to
or is that a horrible idea?