Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow customizing parent controller of Blazer::BaseController #473

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/controllers/blazer/base_controller.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Blazer
class BaseController < ApplicationController
class BaseController < Blazer.base_controller.constantize
# skip filters
filters = _process_action_callbacks.map(&:filter) - [:activate_authlogic]
skip_before_action(*filters, raise: false)
Expand Down
2 changes: 2 additions & 0 deletions lib/blazer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ class << self
attr_accessor :slack_oauth_token
attr_accessor :slack_webhook_url
attr_accessor :mapbox_access_token
attr_accessor :base_controller
end
self.audit = true
self.user_name = :name
Expand All @@ -80,6 +81,7 @@ class << self
self.async = false
self.images = false
self.override_csp = false
self.base_controller = "ApplicationController"

VARIABLE_MESSAGE = "Variable cannot be used in this position"
TIMEOUT_MESSAGE = "Query timed out :("
Expand Down
1 change: 1 addition & 0 deletions lib/blazer/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class Engine < ::Rails::Engine
Blazer.slack_oauth_token = Blazer.settings["slack_oauth_token"] || ENV["BLAZER_SLACK_OAUTH_TOKEN"]
Blazer.slack_webhook_url = Blazer.settings["slack_webhook_url"] || ENV["BLAZER_SLACK_WEBHOOK_URL"]
Blazer.mapbox_access_token = Blazer.settings["mapbox_access_token"] || ENV["MAPBOX_ACCESS_TOKEN"]
Blazer.base_controller = Blazer.settings["base_controller"] || "ApplicationController"
end
end
end
3 changes: 3 additions & 0 deletions lib/generators/blazer/templates/config.yml.tt
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ audit: true
# webhook for Slack
# slack_webhook_url: <%%= ENV["BLAZER_SLACK_WEBHOOK_URL"] %>

# base controller for Blazer::BaseController
# base_controller: ApplicationController

check_schedules:
- "1 day"
- "1 hour"
Expand Down