jbox-web / ajax-datatables-rails

A wrapper around DataTable's ajax methods that allow synchronization with server-side pagination in a Rails app
MIT License
584 stars 228 forks source link

fix: prevent establishing ActiveRecord connection on startup #406

Closed milgner closed 1 year ago

milgner commented 2 years ago

Instead of creating a connection and looking at its database adapter, look at the configured adapter instead.

This prevents issues when trying to compile assets or running other rake tasks in RAILS_ENV=production that are supposed to work without a running database.

milgner commented 2 years ago

Updated the code to use ::ActiveRecord::Base.configurations.configs_for(env_name: Rails.env) instead which is more reliable.

n-rodriguez commented 2 years ago

Fix https://github.com/jbox-web/ajax-datatables-rails/issues/388