Sha256: 11dd8d5a26378c5e84f6d8ecaa8099dbbf3cf72c343e64ab852ea791cce08bcc

Contents?: true

Size: 908 Bytes

Versions: 11

Compression:

Stored size: 908 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

    config.before_configuration do
      config.couchrest_model = CouchRest::Model::Base
    end

    rake_tasks do
      Dir[File.join(File.dirname(__FILE__),'../tasks/*.rake')].each { |f| load f }
    end
  end

end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
couchrest_model-2.2.0.beta2 lib/couchrest/railtie.rb
couchrest_model-2.2.0.beta1 lib/couchrest/railtie.rb
couchrest_model-2.1.0.rc1 lib/couchrest/railtie.rb
couchrest_model-2.1.0.beta2 lib/couchrest/railtie.rb
couchrest_model-2.1.0.beta1 lib/couchrest/railtie.rb
couchrest_model-2.0.4 lib/couchrest/railtie.rb
couchrest_model-2.0.3 lib/couchrest/railtie.rb
couchrest_model-2.0.1 lib/couchrest/railtie.rb
couchrest_model-2.0.0 lib/couchrest/railtie.rb
couchrest_model-2.0.0.beta2 lib/couchrest/railtie.rb
couchrest_model-2.0.0.beta lib/couchrest/railtie.rb