lib/dolly/mango_index.rb in dolly-3.1.4 vs lib/dolly/mango_index.rb in dolly-3.1.5

- old
+ new

@@ -21,11 +21,14 @@ def create(name, fields, type = 'json') post(DESIGN, build_index_structure(name, fields, type)) end def create_in_database(database, name, fields, type = 'json') - connection_for_database(database).post(DESIGN, build_index_structure(name, fields, type)) + db_conn = connection_for_database(database) + return "Migrations for #{database} skiped." if db_conn.skip_migrations? + + db_conn.post(DESIGN, build_index_structure(name, fields, type)) end def find_by_fields(fields) rows = get(ALL_DOCS, key: key_from_fields(fields))[ROWS_KEY] (rows && rows.any?) @@ -44,10 +47,11 @@ end private def connection_for_database(database) - Dolly::Connection.new(database.to_sym, Rails.env || :development) + rails_env = defined?(Rails) ? Rails.env : :development + Dolly::Connection.new(database.to_sym, rails_env) end def connection @connection ||= Dolly::Document.connection end