0

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.

Pedro Rolo
  • 28,273
  • 12
  • 60
  • 94
nichobot
  • 61
  • 6
  • Did you try running locally through bundle exec, using the production environment? That's the only way to be completely sure that everything works right with the production environment settings and bundled gems -- apart from any Heroku-specific issues that might be involved. I believe the command line you need to run is `RAILS_ENV=production bundle exec rails s` . – Steve Jorgensen May 21 '11 at 00:48
  • Thanks for your input. I hadn't tried that, but I have now tried it and a different error occurred: this time the application couldn't find any of my static files in the public directory. I fixed this by placing this line of code - config.serve_static_assets = true in config/environments/production.rb The original problem of not having the gem-based view files is still there. I noticed I don't have a .bundler file in my app -- could that be a problem? – nichobot May 24 '11 at 05:02
  • I don't believe there is ever a .bundle file. You should have Gemfile (the one you manually edit) and Gemfile.lock (the one created/updated by running `bundle install`). – Steve Jorgensen May 24 '11 at 23:09

1 Answers1

3

I had the same problem. To find out if the partial was really there, I created a controller method like:

def files
  render :text => Dir['**/*']
end

I found that the file was definitely there. After a bit more experimentation, I discovered my problem was that I was doing this:

render :partial => 'shared/partial'

rather than this:

render :partial => 'shared/partial.html.erb'
Alex D
  • 29,755
  • 7
  • 80
  • 126