Class: RubyNative::ConfigController

Inherits:
ActionController::Base
  • Object
show all
Defined in:
app/controllers/ruby_native/config_controller.rb

Instance Method Summary collapse

Instance Method Details

#showObject



3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'app/controllers/ruby_native/config_controller.rb', line 3

def show
  RubyNative.load_config if Rails.env.local?
  # The version header stays on the 404 so `ruby_native preview` can tell
  # missing config apart from an unmounted engine.
  response.set_header("X-Ruby-Native-Version", RubyNative::VERSION)

  config = RubyNative.config_as_json
  if config.nil?
    render json: { error: "config/ruby_native.yml is missing or empty" }, status: :not_found
  else
    render json: config
  end
end