在我们的应用程序中,我们将一些视图(.erb文件)存储在public/custom_themes/{user}/文件夹中。我们已经尝试将路径RAILS_ROOT添加到view_paths
,并在render :layout
中指定/custom_themes/{user}/theme.erb
。在development
环境中,它工作得很好,但在production
中,它需要很长时间才能找到视图。它确实找到了,但需要大约2-4分钟的时间来查找和渲染。
请给我建议。
谢谢,
伊姆兰
发布于 2010-10-27 22:54:59
不要使用RAILS_ROOT -您不需要整个rails应用程序(包括所有提供的/缓存的gem和插件!)等着被搜查。您只需要添加您的custom_themes目录:
self.view_paths = ['app/views/', "#{RAILS_ROOT}/public/custom_themes/"]
这应该会大大加快它的速度。
https://stackoverflow.com/questions/4034345
复制相似问题