Sha256: c2a05146332d555a6b079bac9beceed3f5cee4718bd6236ac042f394c6f9028b

Contents?: true

Size: 684 Bytes

Versions: 9

Compression:

Stored size: 684 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/../../rails/reload_classes')
require 'erb'

module CouchPotato
  def self.rails_init
    config = YAML::load(ERB.new(File.read(Rails.root.join('config/couchdb.yml'))).result)[RAILS_ENV]
    if config.is_a?(String)
      CouchPotato::Config.database_name = config
    else
      CouchPotato::Config.database_name = config['database']
      CouchPotato::Config.validation_framework = config['validation_framework']
    end
  end

  if defined?(::Rails::Railtie)
    class Railtie < ::Rails::Railtie
      initializer 'couch_potato.load_config' do |app|
        CouchPotato.rails_init
      end
    end
  else
    rails_init
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
couch_potato-0.5.4 lib/couch_potato/railtie.rb
couch_potato-0.5.3 lib/couch_potato/railtie.rb
couch_potato-0.5.2 lib/couch_potato/railtie.rb
couch_potato-0.5.1 lib/couch_potato/railtie.rb
couch_potato-0.5.0 lib/couch_potato/railtie.rb
davber_couch_potato-0.4.0 lib/couch_potato/railtie.rb
couch_potato-0.4.0 lib/couch_potato/railtie.rb
couch_potato-0.3.2 lib/couch_potato/railtie.rb
couch_potato-0.3.1 lib/couch_potato/railtie.rb