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

alias_method_chain is deprecated in Rails 5 #65

Closed
craig1410 opened this issue Jan 18, 2016 · 10 comments
Closed

alias_method_chain is deprecated in Rails 5 #65

craig1410 opened this issue Jan 18, 2016 · 10 comments
Assignees

Comments

@craig1410
Copy link
Contributor

When booting up my rails app either via rake test or rails server, I get 3 deprecation warnings as follows:

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/craig/Development/LW/mm2/config/application.rb:7)

The line failing is:

Bundler.require(*Rails.groups)

Upon debugging I found these warnings were issued during the loading of the gretel gem and on reviewing the code I found 3 places where alias_method_chain is called. I have created a pull request which seems to work in Ruby 1.9.3 through 2.2.3. I'll post the PR in a moment and would appreciate any feedback.

@acrolink
Copy link

acrolink commented Jul 3, 2016

@craig1410 Would you please explain how to debug this in order to find which gem is causing the warnings?

@craig1410
Copy link
Contributor Author

@acrolink It was a few months ago when I did this but I think I just used my RubyMine IDE debugger tools to step into the code and framework and eventually by interrogating the variables during loading of gems I found the gem responsible. Sorry I can't be more specific and I'm sure there are better ways to do this but I'm pretty sure this is what I did.

Hope this helps, Craig.

@acrolink
Copy link

acrolink commented Jul 4, 2016

Thanks @craig1410 I will give that a try.

@aried3r
Copy link

aried3r commented Jul 8, 2016

Any plans for a release with this change? Since Rails 5 is out and all :)

@WilHall
Copy link
Collaborator

WilHall commented Jul 10, 2016

@aried3r Yes, hopefully in another week or so.

@ktec
Copy link

ktec commented Jul 12, 2016

Anyone coming here, I found adding a little debug to the rails file ...gems/railties-5.0.0/lib/rails/initializable.rb was enough to point me in the right direction....

    def run_initializers(group=:default, *args)
      return if instance_variable_defined?(:@ran)
      initializers.tsort_each do |initializer|
        puts "Initializer: #{initializer.name}"   <<<<<<<<<<<<<< HERE
        initializer.run(*args) if initializer.belongs_to?(group)
      end
      @ran = true
    end

@acrolink
Copy link

@ktec Thanks, I will try the method you had suggested later and report back.

@alecrubin
Copy link

@WilHall @aried3r any updates on resolving this issue?

@kevinelliott
Copy link

I'm also curious about how to resolve this.

@aried3r
Copy link

aried3r commented Jun 3, 2017

This has been fixed in 3.0.9 I believe, see https://github.com/lassebunk/gretel/blob/v3.0.9/lib/gretel/deprecated/show_root_alone.rb

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

No branches or pull requests

7 participants