houdini/config/initializers/reload_api.rb

12 lines
366 B
Ruby
Raw Normal View History

if Rails.env.development?
ActiveSupport::Dependencies.explicitly_unloadable_constants << 'Houdini::V1'
api_files = Dir[Rails.root.join('app', 'api', '**', '*.rb')]
api_reloader = ActiveSupport::FileUpdateChecker.new(api_files) do
Rails.application.reload_routes!
end
ActiveSupport::Reloader.to_prepare do
api_reloader.execute_if_updated
end
end