GitLab Rails Console Cheat Sheet

This is the GitLab Support Team’s collection of information regarding the GitLab Rails console, for use while troubleshooting. It is listed here for transparency, and it may be useful for users with experience with these tools. If you are currently having an issue with GitLab, it is highly recommended that you first check our guide on navigating our Rails console, and your support options, before attempting to use this information.

Some of these scripts could be damaging if not run correctly, or under the right conditions. We highly recommend running them under the guidance of a Support Engineer, or running them in a test environment with a backup of the instance ready to be restored, just in case.
As GitLab changes, changes to the code are inevitable, and so some scripts may not work as they once used to. These are not kept up-to-date as these scripts/commands were added as they were found/needed. As mentioned above, we recommend running these scripts under the supervision of a Support Engineer, who can also verify that they continue to work as they should and, if needed, update the script for the latest version of GitLab.

Find specific methods for an object { |m| m.to_s.include? "sing" }

Find method source


# Example for when we would call project.private?


View available attributes, formatted using pretty print (pp).

For example, determine what attributes contain users’ names and email addresses:

u = User.find_by_username('someuser')
pp u.attributes

Partial output:

 "name"=>"S User",

Then make use of the attributes, testing SMTP, for example:

e =
n =
Notify.test_email(e, "Test email for #{n}", 'Test email').deliver_now
Notify.test_email(, "Test email for #{}",