I've used "require '/.alchemyapi'" in a pure Ruby program to test the response of an API, now I'm ready to use it in my Rails application. The problem is, I don't know where or how to incorporate it within my application. Where am I supposed to put the "require '/.alchemyapi'" statement? Note, this has NO gem associated with it. Thank you in advance for your assistance!
Asked
Active
Viewed 221 times
0
-
I meant to say I've used "require './alchemyapi'" in a pure Ruby program. – Heather May 23 '16 at 18:29
-
You can do it in `config/application.rb`, as described here: [http://guides.rubyonrails.org/initialization.html#config-application](http://guides.rubyonrails.org/initialization.html#config-application) – Michael Gaskill May 23 '16 at 19:01
2 Answers
0
You can put your Ruby codes in lib
folder, and require it like this:
require "#{RAILS.root}/lib/yourcode.rb
just like the suggestion made by Dan here. You can also put your code in another custom directory of your preference and have it accessible from anywhere by manipulating config.load_paths
like the answer provided by Katz here.
0
You can put require
statement into config/application.rb
file for rails application.

Amol Udage
- 2,917
- 19
- 27