diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 5e992f32a3..162975a831 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class ApplicationController < ActionController::Base +class ApplicationController < ActionController::API include ActionView::Helpers::UrlHelper include ActionView::Helpers::DateHelper include ActionView::Helpers::TextHelper diff --git a/config/application.rb b/config/application.rb index 4ecf5c5253..44c5a6a98d 100644 --- a/config/application.rb +++ b/config/application.rb @@ -10,6 +10,8 @@ module Ifme class Application < Rails::Application + # Configuration needed for changing an existing Rails app to API server + config.api_only = true # Initialize configuration defaults for originally generated Rails version. config.load_defaults 6.0 diff --git a/config/environments/development.rb b/config/environments/development.rb index a7c4e64b82..fdf767724b 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -86,4 +86,10 @@ config.action_controller.default_url_options = { host: primary_domain } config.action_controller.asset_host = primary_domain + + # To render an HTML page with debugging information, use the value :default. + # To render debugging information preserving the response format, use the value :api. + # By default, config.debug_exception_response_format is set to :api, when config.api_only is set to true. + # But we set it here explicitly so that we can change it if we want and we know that it is on. + config.debug_exception_response_format = :api end