Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Plain old Ruby object location in Rails

Rails n00b question. I am creating a plain old Ruby object in Rails. But I am not sure if there is a standard location in the app that I should put this object.

Thanks

like image 369
covard Avatar asked Dec 10 '12 16:12

covard


1 Answers

Several choices, but the lib directory is the most common.

If you need to initialize the code, the most common place is config/initializers.

So you might have:

lib/mystuff.rb

and:

config/initializers/mystuff.rb
lib/mystuff.rb

contains your ruby code.

config/initializers/mystuff.rb

contains code that initializes your stuff, whatever Ruby files that are found in config/initializers are run when Rails boots up.

like image 146
RadBrad Avatar answered Sep 29 '22 01:09

RadBrad