Reputation: 2130
I'm trying to extract some functionality from my existing app into a gem. The existing functionality uses an initializer to load up a config file when Rails starts up...
config/initalizers/myinitializer.rb
Where should this initializer go in the gem? Do I mirror the path structure inside the gem or put it somewhere else? This will be my first gem.
Upvotes: 10
Views: 2972
Reputation: 176342
When the Gem is loaded, Rails first looks for a file called init.rb
in the main Gem folder and requires it if available.
This can be a super-simple base skeleton for a Rails plugin packages as Gem:
name
name/lib
name/lib/name.rb
name/test
name/init.rb
Upvotes: 8