How to read library codes 【Ruby on Rails】

Set up path for installing gems

bundle config set path ‘vendor/bundle’ —- local

Find where methods are defined

class Book
def read
end
end
> Book.new.method(:read).source_location
=> ['book.rb', 2]

Use debuggers

Find a caller

class BooksController < ApplicationController
def index
puts caller
end
end
# caller is default in Ruby

My LinkedIn account is below! Please contact me!

https://www.linkedin.com/in/tomoharu-tsutsumi-56051a126/

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store