Configuration

Scorched includes a few configurable options out of the box. These all have common defaults, or are otherwise left intentionally blank to ensure the developer opts-in to any potentially undesirable or surprising behaviour.

There are two sets of configurables. Those which apply to views, and everything else. Each set of configuration options is a Scorched::Options instance. This allows configuration options to be inherited and subsequently overridden by child classes. This is handy in many instances, but a common requirement might be to change the view directory or default layout of some sub-controller.

Options

Each configuration is listed below, with the default value of each included. Note, development environment defaults may override the default values below.

You can also configure the default options when rendering views by setting them on the render_defaults hash. The options specified here are merged with those provided when calling the render method, with the explicit options obviously taking precedence over the defaults.

Refer to the views page for more information.

Here is an example of the configuration options in action. A couple of different ways to set the options are shown. Refer to the API documentation for Scorched::Options for more information.

class MyApp < Scorched::Controller
  config[:static_dir] = '../public'
  render_defaults.merge!(
    dir: 'templates',
    layout: :main_layout
    engine: :haml
  )
end