Sha256: d2edbed319851c632a0af60834e7af1f1ce655f03379b9b642f88e7861c494e3

Contents?: true

Size: 967 Bytes

Versions: 1

Compression:

Stored size: 967 Bytes

Contents

module Superstore
  class Railtie < Rails::Railtie
    rake_tasks do
      load 'superstore/tasks/ks.rake'
    end

    initializer "superstore.config" do |app|
      ActiveSupport.on_load :superstore do
        pathnames = [Rails.root.join('config', 'superstore.yml'), Rails.root.join('config', 'cassandra.yml')]
        if pathname = pathnames.detect(&:exist?)
          config = ERB.new(pathname.read).result
          config = YAML.load(config)

          if config = config[Rails.env]
            self.config = config.symbolize_keys!
          else
            raise "Missing environment #{Rails.env} in superstore.yml"
          end
        end
      end
    end

    # Expose database runtime to controller for logging.
    initializer "superstore.log_runtime" do |app|
      require "superstore/railties/controller_runtime"
      ActiveSupport.on_load(:action_controller) do
        include Superstore::Railties::ControllerRuntime
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
superstore-1.1.2 lib/superstore/railtie.rb