开发者

Where does the Rails initializer go in a gem?

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 ge开发者_运维知识库m or put it somewhere else? This will be my first gem.


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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜