Last Updated: February 25, 2016
· evolve2k

Figuring out the gem version that likely is causing your uninitialized constant error

Coming to an old project without good gem versioning it's often possible getting stuck attempting to resolve which gem version made everything break.

Here is a little tip to help you find the relevant gem version from my adventures with paperclip.

The project used an old version of the 'paperclip' file attachment gem but was now giving me the following error:

ActionView::Template::Error (uninitialized constant AWS::S3::Base)

Stackoverflow was telling me that the above constant 'AWS::S3::Base' had been removed in more recent version of paperclip, but which version?

It's actually quite easy and fun to search the git log and find commits that changed specified string value. Here's what I did.

  1. Clone and get into the project locally:

    $ git clone

    $ cd paperclip

  2. Search the git history for my string:
    (this searches the commit messages and the commits themselves)

    $ git log -S "AWS::S3::Base" -4

(the -4 is just to show the last 4 entries so I don't get too many)
.. 4 entries get listed,.. this looks like the one..

commit 75f413da0f346be3f4b08199c3b7966d2bd5442d
Author: Prem Sichanugrist
Date: Fri Dec 9 17:47:21 2011 -0500
Use AWS::SDK instead of AWS::S3

  1. Look for tags on the commit.

    $ git describe 75f413da0f346be3f4b08199c3b7966d2bd5442d


Oh version 2.4.5! So there you are!

That's the version you want to sniff around on.

Review the repo, if in github, look up that branch, if you are lucky you may find more info in the Readme, changelog or history text files.