Sha256: b0ba0a9e6ae4263cf198fab999065fa6a141d731285c0b0e3fd6c35495ce2ae5

Contents?: true

Size: 1.48 KB

Versions: 3

Compression:

Stored size: 1.48 KB

Contents

module Blazer
  class Engine < ::Rails::Engine
    isolate_namespace Blazer

    initializer "blazer" do |app|
      # use a proc instead of a string
      app.config.assets.precompile << proc { |path| path =~ /\Ablazer\/application\.(js|css)\z/ }
      app.config.assets.precompile << proc { |path| path =~ /\Ablazer\/.+\.(eot|svg|ttf|woff)\z/ }

      Blazer.time_zone ||= Blazer.settings["time_zone"] || Time.zone
      Blazer.audit = Blazer.settings.key?("audit") ? Blazer.settings["audit"] : true
      Blazer.user_name = Blazer.settings["user_name"] if Blazer.settings["user_name"]
      Blazer.from_email = Blazer.settings["from_email"] if Blazer.settings["from_email"]
      Blazer.before_action = Blazer.settings["before_action"] if Blazer.settings["before_action"]

      Blazer.user_class ||= Blazer.settings.key?("user_class") ? Blazer.settings["user_class"] : (User rescue nil)
      Blazer.user_method = Blazer.settings["user_method"]
      if Blazer.user_class
        Blazer.user_method ||= "current_#{Blazer.user_class.to_s.downcase.singularize}"
      end

      Blazer.check_schedules = Blazer.settings["check_schedules"] if Blazer.settings.key?("check_schedules")

      if Blazer.user_class
        Blazer::Query.belongs_to :creator, class_name: Blazer.user_class.to_s
        Blazer::Dashboard.belongs_to :creator, class_name: Blazer.user_class.to_s
        Blazer::Check.belongs_to :creator, class_name: Blazer.user_class.to_s
      end

      Blazer.cache ||= Rails.cache
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
blazer-1.3.2 lib/blazer/engine.rb
blazer-1.3.1 lib/blazer/engine.rb
blazer-1.3.0 lib/blazer/engine.rb