Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better deprecations for Spree::Core:: #9

Merged
merged 2 commits into from
May 12, 2015
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Use backtrace cleaner for preference warnings
  • Loading branch information
jhawthorn committed May 5, 2015
commit 36394c4f7cf581fcc5ded97f0105c2a10ce129c2
6 changes: 5 additions & 1 deletion core/app/models/spree/app_configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,13 @@ def searcher_class=(sclass)
}

DEPRECATED_STORE_PREFERENCES.each do |old_preference_name, store_method|
# Avoid warning about implementation details
bc = ActiveSupport::BacktraceCleaner.new
bc.add_silencer { |line| line =~ %r{spree/preferences} }

# support all the old preference methods with a warning
define_method "preferred_#{old_preference_name}" do
ActiveSupport::Deprecation.warn("#{old_preference_name} is no longer supported on Spree::Config, please access it through #{store_method} on Spree::Store")
ActiveSupport::Deprecation.warn("#{old_preference_name} is no longer supported on Spree::Config, please access it through #{store_method} on Spree::Store", bc.clean(caller))
Store.default.send(store_method)
end
end
Expand Down