westonganger / protected_attributes_continued

The community continued version of protected_attributes for Rails 5+
MIT License
45 stars 33 forks source link

Fix `build_through_record` for Rails >= 5.2.3 #14

Closed sebroeder closed 5 years ago

sebroeder commented 5 years ago

After the change in https://github.com/rails/rails/pull/35799 Rails does not call options_for_through_record anymore. This method was previously used by protected_attributes to pass in the without_protection: true option.

Override the build_through_record method instead and pass the option in there. Only override build_through_record for ActiveRecord versions >= 5.2.3.