Sha256: cbf6c77dafc9839eb6a090948c4039a1ea1505e9069cb7ab3837346b683cbff3

Contents?: true

Size: 729 Bytes

Versions: 17

Compression:

Stored size: 729 Bytes

Contents

require "active_record"

module Dummy

  # Storage for application settings.
  #
  # @example
  #     Dummy::Application.configure do |config|
  #       config.env = :test
  #     end
  #
  class Application
    class << self

      # Configuration settings wrapper for the
      # <tt>ActiveRecord::Tasks::DatabaseTasks</tt>.
      #
      # Establishes AR connection after configuration.
      #
      def configure
        yield tasks
        base.configurations = tasks.database_configuration
        base.establish_connection(tasks.env)
      end

      private

      def base
        @base ||= ActiveRecord::Base
      end

      def tasks
        @tasks ||= ActiveRecord::Tasks::DatabaseTasks
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
uuids-5.0.0 spec/dummy/config/initializers/application.rb
uuids-4.1.8 spec/dummy/config/initializers/application.rb
uuids-4.1.7 spec/dummy/config/initializers/application.rb
uuids-4.1.6 spec/dummy/config/initializers/application.rb
uuids-4.1.5 spec/dummy/config/initializers/application.rb
uuids-4.1.4 spec/dummy/config/initializers/application.rb
uuids-4.1.3 spec/dummy/config/initializers/application.rb
uuids-4.1.2 spec/dummy/config/initializers/application.rb
uuids-4.1.1 spec/dummy/config/initializers/application.rb
uuids-4.1.0 spec/dummy/config/initializers/application.rb
uuids-4.0.1 spec/dummy/config/initializers/application.rb
uuids-4.0.0 spec/dummy/config/initializers/application.rb
uuids-3.0.0 spec/dummy/config/initializers/application.rb
uuids-2.0.0 spec/dummy/config/initializers/application.rb
uuids-1.4.2 spec/dummy/config/initializers/application.rb
uuids-1.4.1 spec/dummy/config/initializers/application.rb
uuids-1.4.0 spec/dummy/config/initializers/application.rb