While trying to understand Ruby at a deeper level and deconstructing a boiler room rail application, it seemed like a good way to understand some of the subtleties and elegance of writing a Ruby application that spans different files and directories.
In my current application, dependency on โrequirementsโ between files becomes a little problematic (I find that I need to do things like requires '../../../lib/helper' and getting it a little ugly.
I noticed that rail applications do not seem to suffer from this.
I noticed a line:
require File.expand_path('../../config/environment', __FILE__)
And when I'm on Google, I find a lot of explanation about the routine Rails program, etc., but there is no clear description of what exactly this line does exactly.
In my travels, I also walked along this line:
$:.push File.join(File.dirname(__FILE__))
I was wondering, somehow this could be a potential solution to my problem. Can someone explain what they are doing for sure?
ruby ruby-on-rails
Ash
source share