makandra / active_type

Make any Ruby object quack like ActiveRecord
MIT License
1.09k stars 74 forks source link

Fix AR config issues [fixes #72] #73

Closed kratob closed 7 years ago

kratob commented 7 years ago

When active_type is used inside Rails it loads ActiveRecord::Base too early. This causes configuration settings set via Rails.application.config.active_record (for example Rails.application.config.belongs_to_required_by_default = true) set in a Rails initializer (as is default in Rails 5) to be disregarded.

In case ActiveType is used without Rails, we should load regularly.

kratob commented 7 years ago

See https://github.com/rails/rails/issues/23589 for the underlying issue and https://github.com/plataformatec/devise/commit/c2c74b0a39238e7d997486814a1c8f75fdaf276f for how Devise fixed it.

kratob commented 7 years ago

@henning-koch Does this look like a sensible solution to you?

triskweline commented 7 years ago

OK, let's release it.