Get class location from class object

后端 未结 7 2164
北恋
北恋 2020-12-13 23:29

I have a bunch of code to look at, and now it is debugging time. Since I have never been a fan of Ruby\'s debugger I am looking for a way of going through code and reading i

7条回答
  •  猫巷女王i
    2020-12-14 00:04

    FYI, In Rails's console or debugging sessions of Rails apps, you can find out the disk-location of the file where that particular class is defined. like

    > show-source Job
    

    this will give you

    From: /home/john/projects/iisifix/app/models/job.rb @ line 13:
    Class name: Job
    Number of monkeypatches: 6. Use the `-a` option to display all available monkeypatches
    Number of lines: 66
    
    class Job < ApplicationRecord
      belongs_to :quote_request
      belongs_to :garage
    

提交回复
热议问题