August 4

0 comments

Searching your gems to troubleshoot Ruby on Rails issues.

By Christopher G Mendla

August 4, 2021


Last Updated on August 4, 2021 by Christopher G Mendla

If you are trying to find a method call that is causing issues and is not in your project code, try searching your gems.

The Problem: A method call was causing issues but it could not be found in the project code.

While doing an update to Rails 5.2.0, I was getting the following error

ActionController::RoutingError at /
undefined method `hide_action' for PagesController:Class

I searched through the project but found no instances of ‘hide_action’. In other words, there was no code in the project making that particular call nor was there a method with that name.

The Solution: Search the gems

I use RVM in an Ubuntu environment. It occurred to me that the call might be coming from one of the gems. I found a stackoverflow article that showed how to grep for the text I needed to find. The command was

grep -rnw '/home/chris/.rvm/' -e 'hide_action'

The search took a minute or two since I have several versions of Ruby installed through RVM. The search gave me the output as shown below

I could see that both actionpack 4.2.11.3 and high-voltage 2.4.0 were making the ‘hide_action’ call. Since I was in the process of upgrading to rails 5.x, I figured the culprit was not actionpack. That left high-voltage. I looked through Gemfile.lock to see that I was using high-voltage 2.4.0. I added a line in Gemfile to set the constraints of high-voltage to a newer version. As I suspected, the newer version had been updated to remove the ‘hide_action’ call. That eliminated the error.

Summary

This allowed me to find the problem, resolve it, and move on to the next problem.

Christopher G Mendla

About the author

A web developer living in Southampton, PA

Self motivated critical thinker and problem solver providing technology consulting services.

Leave a Reply

Your email address will not be published. Required fields are marked

{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}