Support Rails 4.2 and Ruby 2.2

Was noticed by this issue: https://github.com/railsware/js-routes/issues/139
Lets refactor this part a little bit. Are you sure you need a double check for `respond_to?(:superclass)`? Lets extract a part of this code a method.