theSteveMitchell / after_party

Automated post-deploy tasks for Ruby/Rails. Your deployment is the party. This is the after party
MIT License
241 stars 50 forks source link

Initializer file removes the belongs_to_required_by_default config in Rails 5 #34

Closed littleforest closed 7 years ago

littleforest commented 7 years ago

In Rails 5, belongs_to is required by default. However, the initializer file for active record:

AfterParty.setup do |config|
  # ==> ORM configuration
  # Load and configure the ORM. Supports :active_record (default) and
  # :mongoid (bson_ext recommended) by default. Other ORMs may be
  # available as additional gems.
  require "after_party/active_record.rb"
end

is turning that off, likely due to initialization order. Setting

ActiveRecord::Base.belongs_to_required_by_default = true

in the config/application.rb restores the correct behavior, but it would be nice if the gem accounted for this without the override.

sfate commented 7 years ago

@littleforest it was fixed at rails 5.1 version.

Ref: https://github.com/rails/rails/issues/23589#issuecomment-305557647

littleforest commented 7 years ago

@sfate thanks for the info!