Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I see the source code of a gem installed on my machine?

I installed Devise in my Rails app and I want to read through the source code and learn how it works. I looked through the entire folder structure of my Rails app, but couldn't find any code (except for the method calls).

I know I can see the source from the Github repository but I would like to see it in my editor and on my local machine.

I'm guessing this code must be in some main Ruby directory, but I'm having trouble locating it. Any help is appreciated. Thanks.

like image 900
MrPizzaFace Avatar asked Jan 15 '14 18:01

MrPizzaFace


1 Answers

Besides Sergio's suggestion, there is another option.

Within your Rails path

$ bundle open devise

This will open the installed gem in editor with the version specified in Gemfile, very handy.

like image 74
Billy Chan Avatar answered Nov 15 '22 19:11

Billy Chan