Sha256: 07df4ded4dd5b6c713768cd969734a78ec7ef3efa0ff34de490fc85bb709759c

Contents?: true

Size: 690 Bytes

Versions: 4

Compression:

Stored size: 690 Bytes

Contents

module MongoModel
  class Railtie < Rails::Railtie
    initializer "mongomodel.logger" do
      MongoModel.logger ||= ::Rails.logger
    end
    
    initializer "mongomodel.rescue_responses" do
      ActionDispatch::ShowExceptions.rescue_responses['MongoModel::DocumentNotFound'] = :not_found
    end
    
    initializer "mongomodel.database_configuration" do |app|
      require 'erb'
      
      config = Pathname.new(app.paths.config.to_a.first).join("mongomodel.yml")
      
      if File.exists?(config)
        mongomodel_configuration = YAML::load(ERB.new(IO.read(config)).result)
        MongoModel.configuration = mongomodel_configuration[Rails.env]
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
mongomodel-0.2.7 lib/mongomodel/railtie.rb
mongomodel-0.2.6 lib/mongomodel/railtie.rb
mongomodel-0.2.5 lib/mongomodel/railtie.rb
mongomodel-0.2.4 lib/mongomodel/railtie.rb