Skip to content

Commit bf927d3

Browse files
committed
Fix mysql config.
1 parent 50b5b50 commit bf927d3

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

test/activerecord_test.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,18 @@
3838
'schema_search_path' => 'public'
3939
}
4040
}
41+
4142
case db
4243
when :postgresql
4344
ActiveRecord::Base.establish_connection(:postgresql_master)
4445
ActiveRecord::Base.connection.recreate_database('enumerize_test')
4546
when :mysql2
46-
ActiveRecord::Tasks::DatabaseTasks.create ActiveRecord::Base.configurations[db.to_s]
47+
if ActiveRecord::Base.configurations.respond_to?(:[])
48+
ActiveRecord::Tasks::DatabaseTasks.create ActiveRecord::Base.configurations[db.to_s]
49+
else
50+
ActiveRecord::Tasks::DatabaseTasks.create ActiveRecord::Base.configurations.find_db_config(db.to_s)
51+
end
52+
4753
ActiveRecord::Base.establish_connection(db)
4854
else
4955
ActiveRecord::Base.establish_connection(db)

0 commit comments

Comments
 (0)