如何在Rails 4中重新加载路由/ config / routes / *? [英] how to reload routes /config/routes/* in rails 4?
本文介绍了如何在Rails 4中重新加载路由/ config / routes / *?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何强制Rails 4重新加载所有路由文件?
不必重新启动应用程序即可从/ config / routes / 生成路由。 rb得到加载*
我在/config/routes/.rb
中进行了拆分,但这些/ config / routes / 文件未重新加载。 / p>
这在rails 3而不是4上起作用:
#config。 path ['config / routes']。unshift * Dir [ config / routes / *。rb]
解决方案
您可以使用:
Rails.application.reload_routes!
您可以在此处了解相关信息(必须使用查找
)
How to force rails 4 to reload all route files?
That is without having to restart the application to make the routes from /config/routes/.rb get loaded*
I did a split them up in /config/routes/.rb
but these /config/routes/ files are not reloaded.
This worked in rails 3 but not 4:
#config.paths['config/routes'].unshift *Dir["config/routes/*.rb"]
解决方案
You can use:
Rails.application.reload_routes!
You can read about it here (will have to use find
)
这篇关于如何在Rails 4中重新加载路由/ config / routes / *?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文