Configuration

To configure Coupdoeil you can either use an initializer:

# config/initializers/coupdoeil.rb

Coupdoeil.configure do |config|
  config.validate_options = true
end

or set it up in config/environments/ENVIRONMENT.rb:

# config/environments/production.rb

MyApplication.configure do
  config.coupdoeil.validate_options = false
end

Config attributes

.validate_options

Type Boolean
Default Rails.env.local?

Whether to validate popover options before building the tag when calling coupdoeil_popover_tag. It will raise an error with a hint on how to fix it if an option’s value is not valid.

This is enabled in local envs only to save some resources in production, especially on pages rendering a lot a <coup-doeil> tags (not a huge save, but nothing’s negligible if traffic is high or if we consider resources usage cumulated over a long period of time).

Note that default options are validated only once since their compressed version is memoized. So, if you never pass custom option to the helper this option won’t have much impact.

.options_html_attributes

Type Boolean
Default Rails.env.local?

Whether to insert options as HTML attributes of the <coup-doeil> tag for inspection. This is not required for popovers to work since options are compressed as base 36 to lighten the HTML payload. This option is meant to help for debug or testing.

include_all_helpers

Type Boolean
Default true

Whether to load all application helpers so they are available when rendering a popover. This mimics the default behavior of Rails. It is advised to set it to true so that rendering popovers is seamless compared to rendering any other template. For all helpers to be included it is also required that config.action_controller.include_all_helpers is set to true.

delegate_helper_methods

Type Boolean
Default true

Similarly to include_all_helpers, to offer a seamless experience when rendering popovers, Coupdoeil will delegate any helper methods defined on ApplicationController when this option is set to true. Such helper methods could include current_user from Devise or allowed_to? from ActionPolicy, for example. As these helpers are not defined on modules like other helpers, they cannot be included and their call must therefore be delegated to the context controller. If this behavior causes unexpected behavior you can disable it with this configuration option, and/or submit an issue so it can be investigated. However, in absence of problem, it is still recommended to let it true by default.