Sha256: 23d6d2816f03185f71afb320dccfc7e752a2bec945ec391296e9c1b0d70f81ef

Contents?: true

Size: 865 Bytes

Versions: 9

Compression:

Stored size: 865 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'] if config['validation_framework']
      CouchPotato::Config.split_design_documents_per_view = config['split_design_documents_per_view'] if config['split_design_documents_per_view']
    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.6.0 lib/couch_potato/railtie.rb
couch_potato-0.5.7 lib/couch_potato/railtie.rb
couch_potato-rails2-0.5.10 lib/couch_potato/railtie.rb
couch_potato-rails2-0.5.9 lib/couch_potato/railtie.rb
couch_potato-rails2-0.5.8 lib/couch_potato/railtie.rb
couch_potato-rails2-0.5.7 lib/couch_potato/railtie.rb
couch_potato-rails2-0.5.6 lib/couch_potato/railtie.rb
couch_potato-0.5.6 lib/couch_potato/railtie.rb
couch_potato-0.5.5 lib/couch_potato/railtie.rb