Sha256: 8342dcdc6ee5c833e9f52dd42c60c3213b4dbce1299607182f293fd28d41433f

Contents?: true

Size: 700 Bytes

Versions: 5

Compression:

Stored size: 700 Bytes

Contents

require "rails"
require "active_model/railtie"

module CouchRest
  class ModelRailtie < Rails::Railtie
    def self.generator
      config.respond_to?(:app_generators) ? :app_generators : :generators
    end

    config.send(generator).orm :couchrest_model
    config.send(generator).test_framework  :test_unit, :fixture => false

    initializer "couchrest_model.configure_default_connection" do
      CouchRest::Model::Base.configure do |conf|
        conf.environment = Rails.env
        conf.connection_config_file = File.join(Rails.root, 'config', 'couchdb.yml')
        conf.connection[:prefix] =
          Rails.application.class.to_s.underscore.gsub(/\/.*/, '')
      end
    end
  end

end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
couchrest_model-1.2.0.beta lib/couchrest/railtie.rb
openlogic-couchrest_model-1.0.0 lib/couchrest/railtie.rb
couchrest_model-1.1.2 lib/couchrest/railtie.rb
couchrest_model-1.1.1 lib/couchrest/railtie.rb
couchrest_model-1.1.0 lib/couchrest/railtie.rb