简体   繁体   中英

In Ruby on Rails, why do some gems require config/initializers/foo.rb and some gems don't?

For example, I think the gems such as haml doesn't need a file in config/initializers/ , while devise needs a config/initializers/devise.rb .

Why do some gems not need an initializer file and some do? Can they all be made to be without one or all require one? What's the rule?

有些gem需要比其他gem更多的配置,通常是在功能与帐户相关或需要手动配置以与您的特定Rails应用程序配合使用时(例如hoptoad_notifier和devise),其他gems在rails应用程序中提供或添加了更多常规功能,这些方法通常无需任何配置即可工作,但确实具有一定的灵活性,并且可以使用初始化程序(例如haml和will_paginate)进行自定义。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM