DEPRECATION WARNING: alias_method_chain is deprecated. Please, use Module#prepend instead. From module, you can access the original method using super. (called from block in included at /Users/gregblass/.rvm/gems/ruby-2.2.2@project/bundler/gems/wicked_pdf-faa3c0d5f21b/lib/wicked_pdf/pdf_helper.rb:11)
DEPRECATION WARNING: alias_method_chain is deprecated. Please, use Module#prepend instead. From module, you can access the original method using super. (called from block in included at /Users/gregblass/.rvm/gems/ruby-2.2.2@project/bundler/gems/wicked_pdf-faa3c0d5f21b/lib/wicked_pdf/pdf_helper.rb:12)
DEPRECATION WARNING: after_filter is deprecated and will be removed in Rails 5.1. Use after_action instead. (called from block in included at /Users/gregblass/.rvm/gems/ruby-2.2.2@project/bundler/gems/wicked_pdf-faa3c0d5f21b/lib/wicked_pdf/pdf_helper.rb:13)
The after_filter -> after_action is trivial, but I'm trying to wrap my head around how you'd refactor the alias_method_chain. This article seems to be explaining it pretty thoroughly, but it's currently hurting my brain: http://www.justinweiss.com/articles/rails-5-module-number-prepend-and-the-end-of-alias-method-chain/
If someone can make sense of that, a fork/pull request would be nice to silence those every time tests are run. They need to be refactored to modules?
Here is my current plan on how to deal with this:
The only reason we hook into render with alias_method_chain in the first place is to provide a consistent-ish API with Rails's existing render API.
We use the existence of a :pdf hash key to determine wether this render call should be processed through wicked_pdf or not.
I think that it would be an improvement if we made wicked_pdf render calls more explicit, so that instead of this:
format.pdf do
render pdf: 'mypdf', debug: params[:debug]
end
You'd have a more explicit renderer method like this:
format.pdf do
wicked_pdf debug: params[:debug]
end
I want to either preserve compatibility for one major version (to give people an upgrade path), so I'd like to publish a 2.x version of wicked_pdf with both options available, and throwing deprecation warnings to upgrade the syntax of affected render :pdf calls, then publish a 3.x version dropping support for render :pdf syntax.
How does that sound? Would you (or anyone else) like to help?
hey guys, the gem is still throwing me these deprecation warnings, and I'm using version 1.0.6, they only happen in my test enviroment though :confused:
Here are the warnings:
DEPRECATION WARNING: alias_method_chain is deprecated. Please, use Module#prepend instead. From module, you can access the original method using super. (called from <top (required)> at /Users/hashlabs/Documents/CarlosProjects/bills-app/config/environment.rb:5)
DEPRECATION WARNING: alias_method_chain is deprecated. Please, use Module#prepend instead. From module, you can access the original method using super. (called from <top (required)> at /Users/hashlabs/Documents/CarlosProjects/bills-app/config/environment.rb:5)
DEPRECATION WARNING: after_filter is deprecated and will be removed in Rails 5.1. Use after_action instead. (called from <top (required)> at /Users/hashlabs/Documents/CarlosProjects/bills-app/config/environment.rb:5)
As I said they only get thrown when I run my rspec tests
@Carlows Version 1.0.6 didn't include the commits referenced above, they were only available if you are tracking the master branch.
I've cut a new version of the gem 1.1.0 which includes this and more. 馃槃
Please open a new issue if you continue to have issues after upgrading.
Most helpful comment
@Carlows Version
1.0.6didn't include the commits referenced above, they were only available if you are tracking themasterbranch.I've cut a new version of the gem
1.1.0which includes this and more. 馃槃Please open a new issue if you continue to have issues after upgrading.