Sha256: d7bcfb7bc04327926116104dd09f722d54af8ef809ef4197a5014cdf565ebe05

Contents?: true

Size: 650 Bytes

Versions: 11

Compression:

Stored size: 650 Bytes

Contents

require 'slack-ruby-bot-server/models/team/mongoid.rb'
require 'kaminari/grape'
require 'mongoid-scroll'

module SlackRubyBotServer
  module DatabaseAdapter
    def self.check!
      rc = Mongoid.default_client.command(ping: 1)
      return if rc && rc.ok?
      raise rc.documents.first['error'] || 'Unexpected error.'
    rescue StandardError => e
      warn "Error connecting to MongoDB: #{e.message}"
      raise e
    end

    def self.init!
      # create indexes
      ::Mongoid::Tasks::Database.create_indexes
      # silence loggers
      Mongoid.logger.level = Logger::INFO
      Mongo::Logger.logger.level = Logger::INFO
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
slack-ruby-bot-server-0.11.1 lib/slack-ruby-bot-server/config/database_adapters/mongoid.rb
slack-ruby-bot-server-0.11.0 lib/slack-ruby-bot-server/config/database_adapters/mongoid.rb
slack-ruby-bot-server-0.10.0 lib/slack-ruby-bot-server/config/database_adapters/mongoid.rb
slack-ruby-bot-server-0.9.0 lib/slack-ruby-bot-server/config/database_adapters/mongoid.rb
slack-ruby-bot-server-0.8.3 lib/slack-ruby-bot-server/config/database_adapters/mongoid.rb
slack-ruby-bot-server-0.8.2 lib/slack-ruby-bot-server/config/database_adapters/mongoid.rb
slack-ruby-bot-server-0.8.1 lib/slack-ruby-bot-server/config/database_adapters/mongoid.rb
slack-ruby-bot-server-0.8.0 lib/slack-ruby-bot-server/config/database_adapters/mongoid.rb
slack-ruby-bot-server-0.7.0 lib/slack-ruby-bot-server/config/database_adapters/mongoid.rb
slack-ruby-bot-server-0.6.1 lib/slack-ruby-bot-server/config/database_adapters/mongoid.rb
slack-ruby-bot-server-0.6.0 lib/slack-ruby-bot-server/config/database_adapters/mongoid.rb