Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby

Problems with Heroku after completing Ruby Rapids 3

Hi,

Please help! I just finished the advanced treebook app course. Now I'm trying to get the app working on heroku. I had a problem with deploying it, and reading over the logs I found errors with the 'thin' gem, so I tried removing that from the gemfile and recommitting/pushing it.

It seemed to work at first, but now the app is crashed and won't allow me to restart. Here are the error logs from heroku logs:

2013-08-16T23:36:34.295060+00:00 app[web.1]: LINE 1: SELECT 1 AS one FROM "users" INNER JOIN "user_friendships" ... 2013-08-16T23:36:34.293144+00:00 app[web.1]: Completed 500 Internal Server Error in 10ms 2013-08-16T23:36:34.292838+00:00 app[web.1]: Rendered statuses/index.html.erb within layouts/application (7.0ms) 2013-08-16T23:36:34.281214+00:00 app[web.1]: Started GET "/" for 184.96.246.5 at 2013-08-16 23:36:34 +0000 2013-08-16T23:36:34.283399+00:00 app[web.1]: Processing by StatusesController#index as HTML 2013-08-16T23:36:34.295060+00:00 app[web.1]: 9: <div class="status media"> 2013-08-16T23:36:34.295224+00:00 app[web.1]: 10: <%= avatar_profile_link status.user, {}, class: 'pull-left' %> 2013-08-16T23:36:34.295224+00:00 app[web.1]: 11: <div class="media-body"> 2013-08-16T23:36:34.295060+00:00 app[web.1]: 8: <% if can_display_status?(status) %> 2013-08-16T23:36:34.295060+00:00 app[web.1]: 5: <%= link_to "Post a new status", new_status_path, class: "btn btn-success" %> 2013-08-16T23:36:34.295060+00:00 app[web.1]: 7: <% @statuses.each do |status| %> 2013-08-16T23:36:34.295060+00:00 app[web.1]: ^ 2013-08-16T23:36:34.295060+00:00 app[web.1]: 6: 2013-08-16T23:36:34.295060+00:00 app[web.1]: : SELECT 1 AS one FROM "users" INNER JOIN "user_friendships" ON "users"."id" = "user_friendships"."friend_id" WHERE "user_friendships"."user_id" = 1 AND "user_friendships"."state" = 'blocked' AND "users"."id" = 1 LIMIT 1): 2013-08-16T23:36:34.295224+00:00 app[web.1]: app/views/statuses/index.html.erb:7:in each' 2013-08-16T23:36:34.295224+00:00 app[web.1]: app/views/statuses/index.html.erb:7:inapp_views_statuses_index_html_erb4062655564662795157_27328300' 2013-08-16T23:36:34.295224+00:00 app[web.1]: app/controllers/statuses_controller.rb:11:in index' 2013-08-16T23:36:34.295224+00:00 app[web.1]: app/views/statuses/index.html.erb:8:inblock in _app_views_statuses_index_html_erb4062655564662795157_27328300' 2013-08-16T23:36:34.304078+00:00 heroku[router]: at=info method=GET path=/ host=treebook-fluxusfrequency.herokuapp.com fwd="184.96.246.5" dyno=web.1 connect=10ms service=28ms status=500 bytes=643 2013-08-16T23:36:34.295224+00:00 app[web.1]: app/helpers/application_helper.rb:22:in can_display_status?' 2013-08-16T23:36:34.295224+00:00 app[web.1]: app/models/user.rb:85:inhas_blocked?' 2013-08-16T23:36:34.295224+00:00 app[web.1]: 2013-08-16T23:36:34.295224+00:00 app[web.1]: 2013-08-16T23:36:39.826832+00:00 app[web.1]: Started GET "/user_friendships.json" for 184.96.246.5 at 2013-08-16 23:36:39 +0000 2013-08-16T23:36:39.832313+00:00 app[web.1]: Processing by UserFriendshipsController#index as JSON 2013-08-16T23:36:39.846740+00:00 app[web.1]: 2013-08-16T23:36:39.846740+00:00 app[web.1]: ActiveRecord::StatementInvalid (PG::Error: ERROR: relation "user_friendships" does not exist 2013-08-16T23:36:39.848205+00:00 heroku[router]: at=info method=GET path=/user_friendships.json host=treebook-fluxusfrequency.herokuapp.com fwd="184.96.246.5" dyno=web.1 connect=1ms service=26ms status=500 bytes=643 2013-08-16T23:36:39.846740+00:00 app[web.1]: LINE 5: WHERE a.attrelid = '"user_friendships"'::regcla... 2013-08-16T23:36:39.844916+00:00 app[web.1]: Completed 500 Internal Server Error in 12ms 2013-08-16T23:36:39.846740+00:00 app[web.1]: : SELECT a.attname, format_type(a.atttypid, a.atttypmod), 2013-08-16T23:36:39.846740+00:00 app[web.1]: pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod 2013-08-16T23:36:39.846740+00:00 app[web.1]: ^ 2013-08-16T23:36:39.846740+00:00 app[web.1]: AND a.attnum > 0 AND NOT a.attisdropped 2013-08-16T23:36:39.846927+00:00 app[web.1]: ): 2013-08-16T23:36:39.846740+00:00 app[web.1]: WHERE a.attrelid = '"user_friendships"'::regclass 2013-08-16T23:36:39.836311+00:00 heroku[router]: at=info method=GET path=/favicon.ico host=treebook-fluxusfrequency.herokuapp.com fwd="184.96.246.5" dyno=web.1 connect=1ms service=15ms status=304 bytes=0 2013-08-16T23:36:39.846740+00:00 app[web.1]: ON a.attrelid = d.adrelid AND a.attnum = d.adnum 2013-08-16T23:36:39.846740+00:00 app[web.1]: FROM pg_attribute a LEFT JOIN pg_attrdef d 2013-08-16T23:36:39.846927+00:00 app[web.1]: ORDER BY a.attnum 2013-08-16T23:36:39.846927+00:00 app[web.1]: 2013-08-16T23:36:39.846927+00:00 app[web.1]: app/controllers/user_friendships_controller.rb:6:in index' 2013-08-16T23:36:39.846927+00:00 app[web.1]: 2013-08-16T23:36:42.107235+00:00 heroku[router]: at=info method=GET path=/login host=treebook-fluxusfrequency.herokuapp.com fwd="184.96.246.5" dyno=web.1 connect=1ms service=13ms status=302 bytes=112 2013-08-16T23:36:42.112048+00:00 app[web.1]: Filter chain halted as :require_no_authentication rendered or redirected 2013-08-16T23:36:42.112192+00:00 app[web.1]: Completed 302 Found in 3ms (ActiveRecord: 1.3ms) 2013-08-16T23:36:42.105767+00:00 app[web.1]: Started GET "/login" for 184.96.246.5 at 2013-08-16 23:36:42 +0000 2013-08-16T23:36:42.108800+00:00 app[web.1]: Processing by Devise::SessionsController#new as HTML 2013-08-16T23:36:42.112048+00:00 app[web.1]: Redirected to http://treebook-fluxusfrequency.herokuapp.com/ 2013-08-16T23:36:42.221506+00:00 app[web.1]: Started GET "/" for 184.96.246.5 at 2013-08-16 23:36:42 +0000 2013-08-16T23:36:42.223891+00:00 app[web.1]: Processing by StatusesController#index as HTML 2013-08-16T23:36:42.237679+00:00 heroku[router]: at=info method=GET path=/ host=treebook-fluxusfrequency.herokuapp.com fwd="184.96.246.5" dyno=web.1 connect=1ms service=22ms status=500 bytes=643 2013-08-16T23:36:42.234284+00:00 app[web.1]: Completed 500 Internal Server Error in 10ms 2013-08-16T23:36:42.236516+00:00 app[web.1]: LINE 1: SELECT 1 AS one FROM "users" INNER JOIN "user_friendships" ... 2013-08-16T23:36:42.236516+00:00 app[web.1]: ActionView::Template::Error (PG::Error: ERROR: relation "user_friendships" does not exist 2013-08-16T23:36:42.236516+00:00 app[web.1]: 2013-08-16T23:36:42.236516+00:00 app[web.1]: : SELECT 1 AS one FROM "users" INNER JOIN "user_friendships" ON "users"."id" = "user_friendships"."friend_id" WHERE "user_friendships"."user_id" = 1 AND "user_friendships"."state" = 'blocked' AND "users"."id" = 1 LIMIT 1): 2013-08-16T23:36:42.236516+00:00 app[web.1]: ^ 2013-08-16T23:36:42.236516+00:00 app[web.1]: 6: 2013-08-16T23:36:42.233874+00:00 app[web.1]: Rendered statuses/index.html.erb within layouts/application (7.0ms) 2013-08-16T23:36:42.236516+00:00 app[web.1]: 9: <div class="status media"> 2013-08-16T23:36:42.236516+00:00 app[web.1]: 8: <% if can_display_status?(status) %> 2013-08-16T23:36:42.236516+00:00 app[web.1]: 7: <% @statuses.each do |status| %> 2013-08-16T23:36:42.236702+00:00 app[web.1]: 11: <div class="media-body"> 2013-08-16T23:36:42.236702+00:00 app[web.1]: app/views/statuses/index.html.erb:8:inblock in _app_views_statuses_index_html_erb4062655564662795157_27328300' 2013-08-16T23:36:42.236516+00:00 app[web.1]: 5: <%= link_to "Post a new status", new_status_path, class: "btn btn-success" %> 2013-08-16T23:36:42.236702+00:00 app[web.1]: app/models/user.rb:85:in has_blocked?' 2013-08-16T23:36:42.236702+00:00 app[web.1]: app/helpers/application_helper.rb:22:incan_display_status?' 2013-08-16T23:36:42.236702+00:00 app[web.1]: 10: <%= avatar_profile_link status.user, {}, class: 'pull-left' %> 2013-08-16T23:36:42.236702+00:00 app[web.1]: app/views/statuses/index.html.erb:7:in each' 2013-08-16T23:36:42.236702+00:00 app[web.1]: app/views/statuses/index.html.erb:7:in_app_views_statuses_index_html_erb4062655564662795157_27328300' 2013-08-16T23:36:42.236702+00:00 app[web.1]: 2013-08-16T23:36:42.236702+00:00 app[web.1]: app/controllers/statuses_controller.rb:11:in index' 2013-08-16T23:36:42.236702+00:00 app[web.1]: 2013-08-16T23:36:30.536176+00:00 heroku[router]: at=info method=GET path=/favicon.ico host=treebook-fluxusfrequency.herokuapp.com fwd="184.96.246.5" dyno=web.1 connect=7ms service=10ms status=304 bytes=0 2013-08-16T23:59:07.321343+00:00 heroku[router]: at=info method=GET path=/ host=treebook-fluxusfrequency.herokuapp.com fwd="184.96.246.5" dyno=web.1 connect=1ms service=18ms status=500 bytes=643 2013-08-16T23:59:07.319283+00:00 app[web.1]: Started GET "/" for 184.96.246.5 at 2013-08-16 23:59:07 +0000 2013-08-16T23:59:07.321671+00:00 app[web.1]: Processing by StatusesController#index as HTML 2013-08-16T23:59:07.332121+00:00 app[web.1]: ActionView::Template::Error (PG::Error: ERROR: relation "user_friendships" does not exist 2013-08-16T23:59:07.332121+00:00 app[web.1]: 2013-08-16T23:59:07.330256+00:00 app[web.1]: Completed 500 Internal Server Error in 9ms 2013-08-16T23:59:07.332121+00:00 app[web.1]: LINE 1: SELECT 1 AS one FROM "users" INNER JOIN "user_friendships" ... 2013-08-16T23:59:07.332121+00:00 app[web.1]: ^ 2013-08-16T23:59:07.332121+00:00 app[web.1]: : SELECT 1 AS one FROM "users" INNER JOIN "user_friendships" ON "users"."id" = "user_friendships"."friend_id" WHERE "user_friendships"."user_id" = 1 AND "user_friendships"."state" = 'blocked' AND "users"."id" = 1 LIMIT 1): 2013-08-16T23:59:07.332121+00:00 app[web.1]: 6: 2013-08-16T23:59:07.332121+00:00 app[web.1]: 5: <%= link_to "Post a new status", new_status_path, class: "btn btn-success" %> 2013-08-16T23:59:07.329867+00:00 app[web.1]: Rendered statuses/index.html.erb within layouts/application (5.9ms) 2013-08-16T23:59:07.332121+00:00 app[web.1]: 7: <% @statuses.each do |status| %> 2013-08-16T23:59:07.332297+00:00 app[web.1]: app/helpers/application_helper.rb:22:incan_display_status?' 2013-08-16T23:59:07.332297+00:00 app[web.1]: app/models/user.rb:85:in has_blocked?' 2013-08-16T23:59:07.332297+00:00 app[web.1]: app/views/statuses/index.html.erb:8:inblock in _app_views_statuses_index_html_erb4062655564662795157_27328300' 2013-08-16T23:59:07.332121+00:00 app[web.1]: 9: <div class="status media"> 2013-08-16T23:59:07.332297+00:00 app[web.1]: 10: <%= avatar_profile_link status.user, {}, class: 'pull-left' %> 2013-08-16T23:59:07.332297+00:00 app[web.1]: 11: <div class="media-body"> 2013-08-16T23:59:07.332121+00:00 app[web.1]: 8: <% if can_display_status?(status) %> 2013-08-16T23:59:07.332297+00:00 app[web.1]: app/views/statuses/index.html.erb:7:in `_app_views_statuses_index_html_erb_4062655564662795157_27328300' 2013-08-16T23:59:07.332297+00:00 app[web.1]: app/controllers/statuses_controller.rb:11:in index' 2013-08-16T23:59:07.332297+00:00 app[web.1]: app/views/statuses/index.html.erb:7:ineach' 2013-08-16T23:59:07.332297+00:00 app[web.1]: 2013-08-16T23:59:07.332297+00:00 app[web.1]: 2013-08-16T23:59:07.860702+00:00 heroku[router]: at=info method=GET path=/favicon.ico host=treebook-fluxusfrequency.herokuapp.com fwd="184.96.246.5" dyno=web.1 connect=2ms service=5ms status=304 bytes=0

I ran "heroku run rake db:setup" and "heroku run rake db:migrate", then "heroku restart". Now the app works but the gravatars aren't displaying. Strange since they work on my local server. Any thoughts?

1 Answer

Andrew Chalkley
STAFF
Andrew Chalkley
Treehouse Guest Teacher

I ran "heroku run rake db:setup" and "heroku run rake db:migrate", then "heroku restart". Now the app works but the gravatars aren't displaying. Strange since they work on my local server. Any thoughts?

Are the URLs different?

I'm not sure if this is what you mean, but I did change the default heroku url to a custom url.

Andrew Chalkley
Andrew Chalkley
Treehouse Guest Teacher

Hi Ben,

When you view source on the page where the gravatars are supposed to show, are the gravatar urls the same?

Regards
Andrew

I see what you're saying. Here's the source:

<div class="status media">
        <a href="/ben" class="pull-left"><img alt="Assets" src="/assets/" /></a>
        <div class="media-body">
          <h4 class="media-heading">Ben Lewis</h4>
            <p>test status</p>
Andrew Chalkley
Andrew Chalkley
Treehouse Guest Teacher

I don't see any img tags.

Is this the same as your local machine?

No. Actually on my local system I have different test statuses and users that weren't copied to the heroku server. The feed shows a different set of status updates. But here's what it has for the image tags:

<div class="status media">
        <a href="/ben" class="pull-left"><img alt="Heyicon"   src="/system/users/avatars/000/000/001/thumb/heyicon.jpg?1376356697" /></a>
        <div class="media-body">
          <h4 class="media-heading">Ben Lewis</h4>
            <p>Hello, this is a file.</p>

<div class="status media">
        <a href="/johnnydoeseph" class="pull-left"><img alt="In_the_shadows" src="/system/users/avatars/000/000/002/thumb/in_the_shadows.jpg?1376494752" /></a>
        <div class="media-body">
          <h4 class="media-heading">Johnny Doeseph</h4>
            <p>Here&#x27;s my status.</p>

Any thoughts, Andrew? Should I zip up my app and send it? Or would it be a db migration problem somewhere?

Andrew Chalkley
Andrew Chalkley
Treehouse Guest Teacher

Sorry Ben Lewis.

I'm a little confused. Shouldn't each status have a gravatar regardless if they're different status updates?

If you could show the differences in screenshots that'd be great too.

I'm ccing Jason Seifer, he's on vacation this week and I'm on next.

No worries.

Each status does have a gravatar on my local server, but on the remote server the image links are broken.

I'll send some screenshots.

Thanks, have a great vacation!

Ben