简体   繁体   中英

How to configure Rails 3.1 app from a gem?

For example, I want to change rails settings when I require my gem to application.

If I simply put this line

Rails.application.config.assets.prefix = '/app/themes/default/assets'

into my gem, this does not change the settings. I think I need to use some rails hooks there.

Please help me guys

You shouldn't need to configure the path of the assets. When put in the proper place, they should load automatically. You need to define an "Engine". Have a look at a gem I made: https://github.com/iain/formalize-rails

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