Eric M. Seitz
Eric M. Seitz

Reputation: 15

Heroku Error with RoR App. (Devise?)

I recently added a user avatar feature to the Devise edit.html page of my app. The feature (entire app) is working, locally.

Now that I have pushed to Heroku, the User Profile page (devise edit.html) is creating errors that I do not understand or know how to tackle.

I have tried to rake db:migrate on Heroku, and do get deprecation warnings, but I don't think they are the reason for my troubles, because everything works fine, locally.

DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from at /app/Rakefile:7) DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from at /app/Rakefile:7)

Related log:

2015-01-21T19:01:16.221350+00:00 app[web.1]:   Rendered devise/registrations/edit.html.erb within layouts/application (2.8ms)
2015-01-21T19:01:16.223471+00:00 app[web.1]: 
2015-01-21T19:01:16.223480+00:00 app[web.1]:     9:   <div><%= image_tag @user.avatar %></div>
2015-01-21T19:01:16.223474+00:00 app[web.1]: ActionView::Template::Error ( isn't precompiled):
2015-01-21T19:01:16.203961+00:00 app[web.1]: Started GET "/users/edit" for 71.9.233.133 at 2015-01-21 19:01:16 +0000
2015-01-21T19:01:16.223477+00:00 app[web.1]:     7:   <%= f.file_field :avatar %></div>
2015-01-21T19:01:16.223479+00:00 app[web.1]:     8:   <br />
2015-01-21T19:01:16.223483+00:00 app[web.1]:     11:   <br />
2015-01-21T19:01:16.223475+00:00 app[web.1]:     6:   <div><%= f.label :avatar %><br />
2015-01-21T19:01:16.223482+00:00 app[web.1]:     10:   
2015-01-21T19:01:16.223485+00:00 app[web.1]:     12: 
2015-01-21T19:01:16.223487+00:00 app[web.1]:   app/views/devise/registrations/edit.html.erb:9:in `block in _app_views_devise_registrations_edit_html_erb__33245494095269574_70255842973360'
2015-01-21T19:01:16.223489+00:00 app[web.1]:   app/views/devise/registrations/edit.html.erb:3:in `_app_views_devise_registrations_edit_html_erb__33245494095269574_70255842973360'
2015-01-21T19:01:16.223490+00:00 app[web.1]: 
2015-01-21T19:01:16.223492+00:00 app[web.1]: 
2015-01-21T19:01:16.210980+00:00 app[web.1]: Processing by Devise::RegistrationsController#edit as HTML
2015-01-21T19:01:16.221599+00:00 app[web.1]: Completed 500 Internal Server Error in 10.4ms

Relevant HTML

<div><%= f.label :avatar %><br />
  <%= f.file_field :avatar %></div>
  <br />
  <div><%= image_tag @user.avatar %></div>
  
  <br />

Thank you for any guidance and assistance.

Upvotes: 0

Views: 90

Answers (1)

BarFooBar
BarFooBar

Reputation: 1136

You're getting a precompile error with the avatar assets. Try running RAILS_ENV=production bundle exec rake assets:precompile and then pushing again.

You could also try adding Heroku's Rails 12Factor gem (https://github.com/heroku/rails_12factor) to your gemfile in the production group. This makes serving static assets a bit easier.

This article might also be of some help.

Upvotes: 1

Related Questions