-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Deprecate Spree::Promotion::MATCH_POLICIES without replacement
This constant won't be needed anymore in 4.0 when we will remove the any matching policy for promotion rules. I tried to use a more simple ActiveSupport::Deprecation::DeprecatedObjectProxy like: MATCH_POLICIES = ActiveSupport::Deprecation::DeprecatedObjectProxy.new( %w(all any), "Spree::Promotion::MATCH_POLICIES is deprecated, please do not use it anymore.", Spree::Deprecation ) But it prints the deprecation warning twice for some reason. The approach used in this commit will load the file that contains the constant only when it's called, which will also print the warning.
- Loading branch information
Showing
3 changed files
with
11 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Spree::Promotion::MATCH_POLICIES = %w(all any) | ||
Spree::Deprecation.warn('Spree::Promotion::MATCH_POLICIES is deprecated') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters