Rails 5 Warnings

Every time I run my tests, I get these failure 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/johnvanarkelen/Documents/Web development/rails/test-eagle/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/johnvanarkelen/Documents/Web development/rails/test-eagle/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/johnvanarkelen/Documents/Web development/rails/test-eagle/config/environment.rb:5)

When I check line 5 config/environment.rb, this code appears:

Rails.application.initialize!

When I look at my repo for after_action, after_filteror alias_method_chain, it is not found. What can I do to get rid of these warnings?

+4
source share
2 answers

Why

I came across alias_method_chain is deprecated ... from <top (required)> at /path/to/your/environment.rbin a recent rails update. This usually indicates the use in the gem required during a call initialize!in your Rails application or Bundler.requireif you manually require your dependencies (which I ended up with).

It is probably better expressed as:

Gems, , -, , Rails . , !

()

, , :

    • bundle show rails $GEM_PATH, , ( , , , git , ).
  • (grep, ripgrip ag) , . rg "alias_method_chain" <gem path>
  • , , .
  • , !

alias_method_chain Kaminari. Gemfile, , bundle update kaminari, .

>

- ; , , , . ;   , , . , , . :)

+1

. 2 Rails 5. , .

  • rails g model : string visited_at: datetime load_time: decimal
  • rake db: migrate
  • BOOM! ​​ , .

: 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 richOnRails/chartkick/config/application.rb:7) rake aborted!

7 config/application.rb, :

require_relative 'boot'
require 'rails/all'

**Bundler.require(*Rails.groups)**
module Chartkick
    class Application < Rails::Application
    end
end

7: Bundler.require(* Rails.groups) * , 7.

7.


:

  • bundle exec rake db: migrate [ ] ​​

, , - :

bin/rake db:create

rake db:migrate

, . , , . , rails postgresql .

rails new chartkick --database=postgresql

, , .

0

Source: https://habr.com/ru/post/1656938/


All Articles