我的 Rails 3 Bundler gem 在本地工作,但不能在 Heroku 上提供某些布局文件。有什么想法吗?
我正在使用 Social Stream gem,这是一个为 Rails 3 构建的社交网络平台,它似乎从 gem 目录中提取一些视图布局文件,而不是在应用程序文件系统本地。当我在本地提供应用程序时,这工作正常:
渲染 /Library/Ruby/Gems/1.8/gems/social_stream-0.4.4/app/views/frontpage/_header.html.erb (107.8ms)
渲染 /Library/Ruby/Gems/1.8/gems/social_stream-0.4.4/app/views/layouts/_flash.html.erb (0.6ms) 渲染 /Library/Ruby/Gems/1.8/gems/social_stream-0.4.4/app/views/frontpage/_sponsor.html.erb (0.6ms)
渲染 /Library/Ruby/Gems/1.8/gems/social_stream-0.4.4/app/views/layouts/_footer.html.erb (1.1ms)
在布局/frontpage 内渲染 /Library/Ruby/Gems/1.8/gems/social_stream-0.4.4/app/views/frontpage/index.html.erb (322.2ms)
在 374 毫秒内完成 200 OK(查看次数:372.6 毫秒 | ActiveRecord:0.2 毫秒)
我按照将 Social Stream 应用程序逐字部署到 Heroku 的说明,使用 Bundler 在本地安装 gem 并创建 Gemfile.lock 文件。
https://github.com/ging/social_stream /wiki/How-to-deploy-social-stream-to-heroku
但是,当我部署到 Heroku 时,某些页面无法正确加载,这是我在日志中找到的错误消息:
ActionView::Template::Error(缺少部分布局/flash,带有 {:locale=>[:en, :en], :formats=>[:html], :handlers=>[:rjs, :rhtml, :rxml, :builder, :erb]} 在视图路径“/app/app>/views”中, “/app/vendor/plugins/rails_log_stdout/app/views”,“/app/vendor/plugins/rails3_serve_static_assets/app/views”,“/app/vendor/plugins/rails3_disable_x_sendfile/app/views”, “/app/.bundle/gems/ruby/1.8/gems/social_stream-0.4.4/app/views”,“/app/.bundle/gems/ruby/1.8/gems/devise-1.3.4/app/views ”,“/app/.bundle/gems/ruby/1.8/gems/mailboxer-0.1.4/app/views”)
我不明白是什么阻止了布局/闪存文件出现在 Heroku 的服务器上。有什么想法吗?让我知道更多信息是否有用。
提前致谢。
I am playing around with the Social Stream gem, a social networking platform built for Rails 3, which seems to pull some of its view layout files from a gem directory, rather than locally within the app file system. This works fine when I serve the app locally:
Rendered /Library/Ruby/Gems/1.8/gems/social_stream-0.4.4/app/views/frontpage/_header.html.erb (107.8ms)
Rendered /Library/Ruby/Gems/1.8/gems/social_stream-0.4.4/app/views/layouts/_flash.html.erb (0.6ms)
Rendered /Library/Ruby/Gems/1.8/gems/social_stream-0.4.4/app/views/frontpage/_sponsor.html.erb (0.6ms)
Rendered /Library/Ruby/Gems/1.8/gems/social_stream-0.4.4/app/views/layouts/_footer.html.erb (1.1ms)
Rendered /Library/Ruby/Gems/1.8/gems/social_stream-0.4.4/app/views/frontpage/index.html.erb within layouts/frontpage (322.2ms)
Completed 200 OK in 374ms (Views: 372.6ms | ActiveRecord: 0.2ms)
I followed the instructions for deploying a Social Stream app to Heroku word for word, using Bundler to install the gems locally and create a Gemfile.lock file.
https://github.com/ging/social_stream/wiki/How-to-deploy-social-stream-to-heroku
When I deploy to Heroku, though, some pages don't load properly, and this is the error message I find in the logs:
ActionView::Template::Error (Missing partial layouts/flash with {:locale=>[:en, :en], :formats=>[:html], :handlers=>[:rjs, :rhtml, :rxml, :builder, :erb]} in view paths "/app/app>/views", "/app/vendor/plugins/rails_log_stdout/app/views", "/app/vendor/plugins/rails3_serve_static_assets/app/views", "/app/vendor/plugins/rails3_disable_x_sendfile/app/views", "/app/.bundle/gems/ruby/1.8/gems/social_stream-0.4.4/app/views", "/app/.bundle/gems/ruby/1.8/gems/devise-1.3.4/app/views", "/app/.bundle/gems/ruby/1.8/gems/mailboxer-0.1.4/app/views")
I don't understand what is preventing the layouts/flash file from being present on Heroku's server. Any ideas? Let me know if more info would be useful.
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我也有同样的问题。为了查明该部分是否真的存在,我创建了一个控制器方法,例如:
我发现该文件肯定存在。经过更多的实验后,我发现我的问题是我正在这样做:
而不是这样:
I had the same problem. To find out if the partial was really there, I created a controller method like:
I found that the file was definitely there. After a bit more experimentation, I discovered my problem was that I was doing this:
rather than this: