Rails community!
I'm having an issue about upgrading on Rails project from Rails 4.2 to Rails 5.2, issue related to the step from Rails 5.0 to 5.1
/gems/query_reviewer-0.2.2/lib/query_reviewer/mysql_adapter_extensions.rb:4:in `included': undefined method `alias_method_chain' for ActiveRecord::ConnectionAdapters::Mysql2Adapter:Class (NoMethodError)
I've read a lot of related questions here, and I understood that method alias_method_chains
is deprecated with Rails 5.1...
However, here, issue comes from a gem, especially gem query_reviewer
( github , rubygems ): Last version of this gem is 0.2.2 (septembre 16, 2013) and includes the deprecated method:
module QueryReviewer
module MysqlAdapterExtensions
def self.included(base)
base.alias_method_chain :select, :review
base.alias_method_chain :update, :review
base.alias_method_chain :insert, :review
base.alias_method_chain :delete, :review
end
Obviously, this gem is not available with Rails 5.1, and obvious but painful option would be to look for an other gem... But, maybe, someone had the same issue and found a better way to answer to this 1st question as StackOverflow user ;) ?
Thanks by advance
In rails 5+ alias_method_chain has removed, so in place of this we can use alias_method like below
base.alias_method :select_without_review, :select
base.alias_method :select, :select_with_review
base.alias_method :update_without_review, :update
base.alias_method :update, :update_with_review
base.alias_method :insert_without_review, :insert
base.alias_method :insert, :insert_with_review
base.alias_method :delete_without_review, :delete
base.alias_method :delete, :delete_with_review
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.