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

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -

c# - How to execute a particular part of code asynchronously in a class -