How can I make some code available throughout a Rails app conveniently? -
i want add library wrote rails app (and other rails apps later). tried putting in /lib
seemed logical...
[rails_root]/lib/my_lib/the_main_file.rb [rails_root]/lib/my_lib/some_other_file.rb
then...
require 'my_lib/the_main_file'
that works fine.
but great way it?
now have put require
everywhere want call library.
i thought putting require
in initializer seems kind of weird.
what people this?
using initializer may weird when have single file include, have many files want add, , end using intializer includes stuff. it's pretty neat.
Comments
Post a Comment