2017.03.19 00:00 | Kurt Tomlinson
Sometimes you need to add some special functions to your Ruby on Rails app, and you want these functions to be available everywhere in your application. In cases like these, you can put your code somewhere in Ruby on Rails's load path, and it will be loaded automatically without you having to "require" it in any of your other files.
For example, in Bloopist, I often need to process some Markdown and convert it to plain old HTML. For this, I made a method called markdown_to_html, and put it in my load path.
This raises the question, "what directories are in my Rails app's load path?" That's a pretty easy question to answer. Just load up your rails console and run the command puts $:.
$ rails console
> puts $:
Anything in the load path will be autoloaded by Rails so you don't need to require anything in those paths.