Closed foxlance closed 3 years ago
PR that makes the original change in behaviour - https://github.com/rails/rails/pull/29301 was merged on June 28, 2017. Was merged before Rails 5.1.3 but I think was only released for 5.2.0 (https://github.com/rails/rails/issues/33387).
PR which removes the scoping block - https://github.com/rails/rails/pull/33394 was merged on July 19, 2018. Would be included in Rails 5.2.1
I think that lets keep the scoping
block for versions 5.1 and below. Can you add this change?
@westonganger Done! Let me know if you find anything else worth addressing.
@foxlance you added the scoping back for all Rails versions. We want the scoping block to be removed for Rails 5.2+.
@westonganger Is the recent commit what you have in mind?
Merged. Thanks for your contribution.
v1.8.0 is now released which contains this fix.
This fix addresses the
NoMethodError: undefined method _deprecated_scope_block for ActiveRecord::AssociationRelation
error one might encounter when using.first_or_create
, and possibly.first_or_initialize
after awhere
clause on an association, e.g.This bug is specific to Rails 6.1.x with protected_attributes_continued v1.7.0. Downgrading to protected_attributes_continued v1.6.0 works if one is not after any specific 1.7.0 features.
This fix is inspired by https://github.com/rails/rails/commit/255a7ef7b09ba96f92c7c8a8d59666314551f454.