Q:

How to know in which file is constant defined?

Let's say that I have model User defined in  "c:\rails\project\app\models\user.rb" and I run "ruby script/console" Is there any way to get to know in which file User was defined iside console(in other words if I have User as a class I need to obtain path to file where class was defined)? 

A:

This isn't really answering your question, but I'll chime in anyway. Standard Ruby/Rails conventions say that there should be one class per file and that the file should be the name of the class. There is rarely any reason to stray from this pattern. 

