Usage of Hash#diff prints a million deprecation warnings to server log #93

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet

Footnotes::Extensions::Routes::filtered_routes uses Hash#diff which has been deprecated by Rails 4 (or earlier?), see rails/rails#8158. This cause the server to print a bazillion deprecation warnings to the server log on every refresh:

DEPRECATION WARNING: Hash#diff is no longer used inside of Rails, and is being deprecated with no replacement. If you're using it to compare hashes for the purpose of testing, please use MiniTest's assert_equal instead. (called from require at bin/rails:4)
DEPRECATION WARNING: Hash#diff is no longer used inside of Rails, and is being deprecated with no replacement. If you're using it to compare hashes for the purpose of testing, please use MiniTest's assert_equal instead. (called from require at bin/rails:4)
DEPRECATION WARNING: Hash#diff is no longer used inside of Rails, and is being deprecated with no replacement. If you're using it to compare hashes for the purpose of testing, please use MiniTest's assert_equal instead. (called from require at bin/rails:4)
...

I just extracted the original diff into a local function without touching the logic in filtered_routes.

this commit works perfecly, thank you =D
@josevalim I found this gem by accident helping somebody on IRC, amazing! thank you!

mclee commented Jul 13, 2013

This saved my development logs. Thanks! Hope it gets merged soon.

It will be nice to see this merged 👍

iabdulin commented Aug 7, 2013

+1

+1

gaurish commented Aug 29, 2013

👍

Perf commented Oct 7, 2013

+1

Collaborator

romanvbabenko commented Oct 18, 2013

fixed

cmalpeli commented Jan 6, 2014

Has this been merged into 3.7.4? Just installed Rails 4.0.2 and this is filling up my logs!

👍 to this too, waiting for a proper release

memoht commented Feb 18, 2014

+1 to this. rails-footnotes 3.8 please.

+1

+1 this please

@josevalim josevalim reopened this Feb 25, 2014

Owner

josevalim commented Feb 25, 2014

Can someone please submit a new pull request? Also, we should move diff to a private method instead of defining it inline. :)

@josevalim It looks like this fix is already in master? https://github.com/josevalim/rails-footnotes/blob/master/lib/rails-footnotes/notes/routes_note.rb#L37-L52. Am I missing something? It looks like it follows the same algorithm as this PR.

Owner

josevalim commented Feb 25, 2014

Awesome, thanks!

@josevalim josevalim closed this Feb 25, 2014

jmuheim commented Mar 11, 2014

I'm still getting tons of these:

DEPRECATION WARNING: Hash#diff is no longer used inside of Rails, and is being deprecated with no replacement. If you're using it to compare hashes for the purpose of testing, please use MiniTest's assert_equal instead. (called from handle at /Users/josh/Library/Application Support/Pow/Versions/0.4.1/node_modules/nack/lib/nack/server.rb:145)
DEPRECATION WARNING: Hash#diff is no longer used inside of Rails, and is being deprecated with no replacement. If you're using it to compare hashes for the purpose of testing, please use MiniTest's assert_equal instead. (called from handle at /Users/josh/Library/Application Support/Pow/Versions/0.4.1/node_modules/nack/lib/nack/server.rb:145)
DEPRECATION WARNING: Hash#diff is no longer used inside of Rails, and is being deprecated with no replacement. If you're using it to compare hashes for the purpose of testing, please use MiniTest's assert_equal instead. (called from handle at /Users/josh/Library/Application Support/Pow/Versions/0.4.1/node_modules/nack/lib/nack/server.rb:145)

While nothing seems to point to rails-footnotes here, removing it from Gemfile results in no such deprecation warnings are logged anymore. Anyone has the same problem?

@jmuheim Are you pointing at master?

jmuheim commented Mar 11, 2014

When pointing go master, I get these:

DEPRECATION WARNING: ActionController::AbstractRequest and ActionController::Request are deprecated and will be removed, use ActionDispatch::Request instead. (called from <top (required)> at /Users/josh/.rvm/gems/ruby-2.1.0@synaesthesia/bundler/gems/rails-footnotes-e16074fa3b98/lib/rails-footnotes/notes/routes_note.rb:59)
DEPRECATION WARNING: ActionController::AbstractResponse and ActionController::Response are deprecated and will be removed, use ActionDispatch::Response instead. (called from <top (required)> at /Users/josh/.rvm/gems/ruby-2.1.0@synaesthesia/bundler/gems/rails-footnotes-e16074fa3b98/lib/rails-footnotes/notes/routes_note.rb:59)
DEPRECATION WARNING: ActionController::Routing is deprecated and will be removed, use ActionDispatch::Routing instead. (called from <top (required)> at /Users/josh/.rvm/gems/ruby-2.1.0@synaesthesia/bundler/gems/rails-footnotes-e16074fa3b98/lib/rails-footnotes/notes/routes_note.rb:59)
DEPRECATION WARNING: Filter object with #filter method is deprecated. Define method corresponding to filter type (#before, #after or #around). (called from included at /Users/josh/.rvm/gems/ruby-2.1.0@synaesthesia/bundler/gems/rails-footnotes-e16074fa3b98/lib/rails-footnotes/extension.rb:4)
DEPRECATION WARNING: Filter object with #filter method is deprecated. Define method corresponding to filter type (#before, #after or #around). (called from included at /Users/josh/.rvm/gems/ruby-2.1.0@synaesthesia/bundler/gems/rails-footnotes-e16074fa3b98/lib/rails-footnotes/extension.rb:5)
Collaborator

Intrepidd commented Mar 11, 2014

Hey, a new version is being cooked, all warnings should be gone. See branch wip-refactoring and release-4.0

Pull requests are welcome on those branches.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment