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 trialGabe Med
7,457 PointsThe "Yes, Add friend" page operates locally but not on Heroku.
When clicking the Add Friend button I get "We're sorry, but something went wrong." The "Yes, Add friend" page operates locally but not on Heroku. here's the heroku log:
2013-03-08T07:31:08+00:00 app[web.1]:
2013-03-08T07:31:08+00:00 app[web.1]:
2013-03-08T07:31:08+00:00 app[web.1]: Started GET "/user_friendships/new?friend_id=gabrielmedina" for 72.227.136.84 at 2013-03-08 07:31:08 +0000
2013-03-08T07:31:08+00:00 app[web.1]: Processing by UserFriendshipsController#new as HTML
2013-03-08T07:31:08+00:00 app[web.1]: Parameters: {"friend_id"=>"gabrielmedina"}
2013-03-08T07:31:08+00:00 app[web.1]: Completed 500 Internal Server Error in 14ms
2013-03-08T07:31:08+00:00 app[web.1]:
2013-03-08T07:31:08+00:00 app[web.1]: ActiveRecord::StatementInvalid (PG::Error: ERROR: relation "user_friendships" does not exist
2013-03-08T07:31:08+00:00 app[web.1]: LINE 4: WHERE a.attrelid = '"user_friendships"'::regcla...
2013-03-08T07:31:08+00:00 app[web.1]: ^
2013-03-08T07:31:08+00:00 app[web.1]: : SELECT a.attname, format_type(a.atttypid, a.atttypmod), d.adsrc, a.attnotnull
2013-03-08T07:31:08+00:00 app[web.1]: FROM pg_attribute a LEFT JOIN pg_attrdef d
2013-03-08T07:31:08+00:00 app[web.1]: ON a.attrelid = d.adrelid AND a.attnum = d.adnum
2013-03-08T07:31:08+00:00 app[web.1]: WHERE a.attrelid = '"user_friendships"'::regclass
2013-03-08T07:31:08+00:00 app[web.1]: AND a.attnum > 0 AND NOT a.attisdropped
2013-03-08T07:31:08+00:00 app[web.1]: ORDER BY a.attnum
2013-03-08T07:31:08+00:00 app[web.1]: ):
2013-03-08T07:31:08+00:00 app[web.1]: app/controllers/user_friendships_controller.rb:8:in `new'
2013-03-08T07:31:08+00:00 app[web.1]:
2013-03-08T07:31:08+00:00 app[web.1]:
2013-03-08T07:31:08+00:00 heroku[router]: at=info method=GET path=/user_friendships/new?friend_id=gabrielmedina host=musikarus.herokuapp.com fwd="72.227.136.84" dyno=web.1 queue=0 wait=0ms connect=2ms service=24ms status=500 bytes=643
4 Answers
Alan Johnson
7,625 PointsIt'll be a little tricky to troubleshoot without seeing more code, but are you sure that everything's migrated up on Heroku?
heroku run rake db:migrate
Gabe Med
7,457 PointsAlan Thank you, that did it! Do I migrate every time before a git push heroku?
Alan Johnson
7,625 PointsAwesome news, Gabe! You don't have to migrate every time you deploy, but any time that you've created a new migration you'll want to.
George Petrov
9,663 PointsDoesn't work for me, halfway during the creation of Friendships (when they were unfinished) I did a $ git push heroku master, and I made a friend request (on heroku) without migrating the database. Now, when friendships are done, i pushed to heroku again and I did heroku run rake db:migrate and I still get an application error when I try to "Yes, add friend!" a user. Please help! Do I have to do a UserFriendship.delete_all from pg in production mode? that seemed to fix it locally in the video? if yes, how? app url: rockstage.herokuapp.com
thanks!