Module: Acta::Web

Defined in:
lib/acta/web.rb,
lib/acta/web/engine.rb,
lib/acta/web/events_query.rb,
app/helpers/acta/web/application_helper.rb,
app/controllers/acta/web/events_controller.rb,
app/controllers/acta/web/application_controller.rb

Defined Under Namespace

Modules: ApplicationHelper Classes: ApplicationController, ConfigurationError, Engine, EventsController, EventsQuery

Class Method Summary collapse

Class Method Details

.base_controller_classObject

The host-app controller class (as a String) that engine controllers should inherit from. Set this to your ‘ApplicationController` (or any base controller that enforces authentication) before mounting:

# config/initializers/acta_web.rb
Acta::Web.base_controller_class = "ApplicationController"

No default is provided: a misconfigured mount would expose the entire event log without authentication.



22
23
24
25
26
27
28
29
30
31
# File 'lib/acta/web.rb', line 22

def base_controller_class
  @base_controller_class || raise(
    ConfigurationError,
    "Acta::Web.base_controller_class is not set. Configure it before " \
    "mounting the engine, e.g. in config/initializers/acta_web.rb:\n\n" \
    "    Acta::Web.base_controller_class = \"ApplicationController\"\n\n" \
    "Set it to a controller class that enforces authentication so the " \
    "event log isn't publicly accessible."
  )
end

.base_controller_class=(klass) ⇒ Object



33
34
35
# File 'lib/acta/web.rb', line 33

def base_controller_class=(klass)
  @base_controller_class = klass
end

.reset_configuration!Object

Test/reset hook — clears the configured controller class. Mainly for specs.



38
39
40
# File 'lib/acta/web.rb', line 38

def reset_configuration!
  @base_controller_class = nil
end