title: Completed 500 Internal Server Error in 142ms (Views: 9.8ms | ActiveRecord: 34.6ms)
body: <p>So, I have an application that allows users to create events and activities and others can view them (in the show page) and attend if they'd like.</p>
  
  <p>Now the thing is, I'm able to click on an Event and the event#show page pops up and everything is great, incidentally the Activity page doesn't open, I get a 404 error.</p>
  
  <p>When checking the heroku logs, and the development console logs in development I don't see any visible errors, the only error I see is:</p>
  
  <pre><code> Completed 500 Internal Server Error in 142ms (Views: 9.8ms | ActiveRecord: 34.6ms)
  </code></pre>
  
  <p>What could this be? I've looked over the code several times and there aren't any obvious problems, and also it works in development I only get this 404 in production.. Any ideas?</p>
  
  <p>Update: Heroku logs:</p>
  
  <pre><code>2014-04-07T17:08:57.651579+00:00 app[web.1]:   Parameters: {"id"=&gt;"4"}
  2014-04-07T17:08:57.651738+00:00 app[web.1]: Geokit is using the domain: *hidden*
  2014-04-07T17:08:57.657087+00:00 app[web.1]:   User Load (3.8ms)  SELECT "users".* FROM "users" ORDER BY random() LIMIT 5
  2014-04-07T17:08:57.663588+00:00 app[web.1]:   User Load (4.4ms)  SELECT "users".* FROM "users" WHERE "users"."id" = 40 ORDER BY "users"."id" ASC LIMIT 1
  2014-04-07T17:08:57.672547+00:00 app[web.1]:   Activity Load (7.7ms)  SELECT "activities".* FROM "activities" WHERE "activities"."id" = $1 LIMIT 1  [["id", "4"]]
  2014-04-07T17:08:57.676877+00:00 app[web.1]:   User Load (2.8ms)  SELECT "users".* FROM "users" WHERE "users"."id" = $1 ORDER BY "users"."id" ASC LIMIT 1  [["id", 38]]
  2014-04-07T17:08:57.693696+00:00 app[web.1]:   Photo Load (1.3ms)  SELECT "photos".* FROM "photos" WHERE "photos"."attachable_id" = $1 AND "photos"."attachable_type" = $2 AND "photos"."profile_photo" = 't' ORDER BY "photos"."id" ASC LIMIT 1  [["attachable_id", 40], ["attachable_type", "User"]]
  2014-04-07T17:08:57.697251+00:00 app[web.1]:   Ethnicity Load (1.0ms)  SELECT "ethnicities".* FROM "ethnicities" WHERE "ethnicities"."id" = $1 ORDER BY "ethnicities"."id" ASC LIMIT 1  [["id", 6]]
  2014-04-07T17:08:57.699600+00:00 app[web.1]:   Education Load (1.5ms)  SELECT "educations".* FROM "educations" WHERE "educations"."id" = $1 ORDER BY "educations"."id" ASC LIMIT 1  [["id", 4]]
  2014-04-07T17:08:57.710452+00:00 app[web.1]:   Question Load (9.6ms)  SELECT "questions".* FROM "questions" WHERE "questions"."user_id" = $1  [["user_id", 40]]
  2014-04-07T17:08:57.712549+00:00 app[web.1]:   CACHE (0.0ms)  SELECT "photos".* FROM 
  "photos" WHERE "photos"."attachable_id" = $1 AND "photos"."attachable_type" = $2 AND "photos"."profile_photo" = 't' ORDER BY "photos"."id" ASC LIMIT 1  [["attachable_id", 40], ["attachable_type", "User"]]
  2014-04-07T17:08:57.728908+00:00 app[web.1]:   CACHE (15.5ms)  SELECT "photos".* FROM "photos" WHERE "photos"."attachable_id" = $1 AND "photos"."attachable_type" = $2 AND "photos"."profile_photo" = 't' ORDER BY "photos"."id" ASC LIMIT 1  [["attachable_id", 40], ["attachable_type", "User"]]
  2014-04-07T17:08:57.730101+00:00 app[web.1]:   CACHE (0.0ms)  SELECT "photos".* FROM "photos" WHERE "photos"."attachable_id" = $1 AND "photos"."attachable_type" = $2 AND "photos"."profile_photo" = 't' ORDER BY "photos"."id" ASC LIMIT 1  [["attachable_id", 40], ["attachable_type", "User"]]
  2014-04-07T17:08:57.730981+00:00 app[web.1]:   CACHE (0.1ms)  SELECT "photos".* FROM "photos" WHERE "photos"."attachable_id" = $1 AND "photos"."attachable_type" = $2 AND "photos"."profile_photo" = 't' ORDER BY "photos"."id" ASC LIMIT 1  [["attachable_id", 40], ["attachable_type", "User"]]
  2014-04-07T17:08:57.761039+00:00 app[web.1]:   Rendered layouts/_left_side.html.erb (72.0ms)
  2014-04-07T17:08:57.731304+00:00 app[web.1]:   Rendered layouts/_profile_completion.html.erb (19.6ms)
  2014-04-07T17:08:57.760362+00:00 app[web.1]:   Message Exists (3.4ms)  SELECT 1 AS one FROM "messages" WHERE "messages"."recipient_id" = $1 AND "messages"."is_new" = 't' LIMIT 1  [["recipient_id", 40]]
  2014-04-07T17:08:57.786347+00:00 app[web.1]:   CACHE (0.1ms)  SELECT "photos".* FROM "photos" WHERE "photos"."attachable_id" = $1 AND "photos"."attachable_type" = $2 AND "photos"."profile_photo" = 't' ORDER BY "photos"."id" ASC LIMIT 1  [["attachable_id", 40], ["attachable_type", "User"]]
  2014-04-07T17:08:57.782607+00:00 app[web.1]:    (1.6ms)  SELECT COUNT(*) FROM "comments" WHERE "comments"."commentable_id" = $1 AND "comments"."commentable_type" = $2  [["commentable_id", 4], ["commentable_type", "Activity"]]
  2014-04-07T17:08:57.799144+00:00 app[web.1]:   CACHE (0.0ms)  SELECT "photos".* FROM "photos" WHERE "photos"."attachable_id" = $1 AND "photos"."attachable_type" = $2 AND "photos"."profile_photo" = 't' ORDER BY "photos"."id" ASC LIMIT 1  [["attachable_id", 40], ["attachable_type", "User"]]
  2014-04-07T17:08:57.818837+00:00 app[web.1]:   Rendered collection (0.0ms)
  2014-04-07T17:08:57.833708+00:00 app[web.1]:   User Exists (5.2ms)  SELECT 1 AS one FROM "users" INNER JOIN "activity_participants" ON "users"."id" = "activity_participants"."user_id" WHERE "activity_participants"."activity_id" = $1 AND "users"."id" = 40 LIMIT 1  [["activity_id", 4]]
  2014-04-07T17:08:57.840280+00:00 app[web.1]:   Photo Load (3.9ms)  SELECT "photos".* FROM "photos" WHERE "photos"."attachable_id" = $1 AND "photos"."attachable_type" = $2 AND "photos"."profile_photo" = 't' ORDER BY "photos"."id" ASC LIMIT 1  [["attachable_id", 38], ["attachable_type", "User"]]
  2014-04-07T17:08:57.818561+00:00 app[web.1]:   Comment Load (5.1ms)  SELECT "comments".* FROM "comments" WHERE "comments"."commentable_id" = $1 AND "comments"."commentable_type" = $2 AND "comments"."parent_id" IS NULL  [["commentable_id", 4], ["commentable_type", "Activity"]]
  2014-04-07T17:08:57.841447+00:00 app[web.1]:   CACHE (0.0ms)  SELECT "photos".* FROM "photos" WHERE "photos"."attachable_id" = $1 AND "photos"."attachable_type" = $2 AND "photos"."profile_photo" = 't' ORDER BY "photos"."id" ASC LIMIT 1  [["attachable_id", 38], ["attachable_type", "User"]]
  2014-04-07T17:08:57.858143+00:00 app[web.1]:    (5.4ms)  SELECT COUNT(*) FROM "users" INNER JOIN "activity_participants" ON "users"."id" = "activity_participants"."user_id" WHERE "activity_participants"."activity_id" = $1  [["activity_id", 4]]
  2014-04-07T17:08:57.863920+00:00 app[web.1]:   CACHE (0.0ms)  SELECT "photos".* FROM "photos" WHERE "photos"."attachable_id" = $1 AND "photos"."attachable_type" = $2 AND "photos"."profile_photo" = 't' ORDER BY "photos"."id" ASC LIMIT 1  [["attachable_id", 38], ["attachable_type", "User"]]
  2014-04-07T17:08:57.861996+00:00 app[web.1]:   User Load (3.0ms)  SELECT "users".* FROM "users" INNER JOIN "activity_participants" ON "users"."id" = "activity_participants"."user_id" WHERE "activity_participants"."activity_id" = $1  [["activity_id", 4]]
  2014-04-07T17:08:57.864761+00:00 app[web.1]:   CACHE (0.0ms)  SELECT "photos".* FROM "photos" WHERE "photos"."attachable_id" = $1 AND "photos"."attachable_type" = $2 AND "photos"."profile_photo" = 't' ORDER BY "photos"."id" ASC LIMIT 1  [["attachable_id", 38], ["attachable_type", "User"]]
  2014-04-07T17:08:57.869745+00:00 app[web.1]:   Rendered activities/_activity_right_side.html.erb (45.4ms)
  2014-04-07T17:08:57.869976+00:00 app[web.1]:   Rendered activities/show.html.erb within layouts/application (184.0ms)
  2014-04-07T17:08:57.871758+00:00 app[web.1]:   Rendered errors/error_500.html.erb within layouts/application (0.5ms)
  2014-04-07T17:08:57.875144+00:00 app[web.1]:   Event Load (1.5ms)  SELECT "events".* FROM "events" INNER JOIN "event_participants" ON "events"."id" = "event_participants"."event_id" WHERE "event_participants"."user_id" = $1  [["user_id", 40]]
  2014-04-07T17:08:57.875788+00:00 app[web.1]:   Rendered layouts/_pusher.html.erb (3.1ms)
  2014-04-07T17:08:57.880542+00:00 app[web.1]:   Notification Exists (1.1ms)  SELECT 1 AS one FROM "notifications" WHERE "notifications"."user_id" = $1 AND "notifications"."is_opened" = 'f' LIMIT 1  [["user_id", 40]]
  2014-04-07T17:08:57.882166+00:00 app[web.1]:   CACHE (0.0ms)  SELECT 1 AS one FROM "notifications" WHERE "notifications"."user_id" = $1 AND "notifications"."is_opened" = 'f' LIMIT 1  [["user_id", 40]]
  2014-04-07T17:08:57.891660+00:00 heroku[router]: at=info method=GET path=/activities/4 host=*hidden* request_id=f6f6ab0e-c627-482d-a49b-d7d351ba398a fwd="99.234.25.253" dyno=web.1 connect=9ms service=393ms status=500 bytes=10914
  2014-04-07T17:08:57.884160+00:00 app[web.1]:   CACHE (0.0ms)  SELECT 1 AS one FROM "messages" WHERE "messages"."recipient_id" = $1 AND "messages"."is_new" = 't' LIMIT 1  [["recipient_id", 40]]
  2014-04-07T17:08:57.883375+00:00 app[web.1]:   CACHE (0.0ms)  SELECT 1 AS one FROM "messages" WHERE "messages"."recipient_id" = $1 AND "messages"."is_new" = 't' LIMIT 1  [["recipient_id", 40]]
  2014-04-07T17:08:57.884773+00:00 app[web.1]:   Rendered shared/_header.html.erb (8.2ms)
  2014-04-07T17:08:57.885126+00:00 app[web.1]:   Rendered layouts/_flash.html.erb (0.1ms)
  2014-04-07T17:08:57.885902+00:00 app[web.1]: Completed 500 Internal Server Error in 234ms (Views: 12.7ms | ActiveRecord: 81.1ms)
  2014-04-07T17:08:57.885600+00:00 app[web.1]:   Rendered shared/_footer.html.erb (0.2ms)
  2014-04-07T17:08:58.357410+00:00 heroku[router]: at=info method=GET path=/assets/logo-404-6d97dc33614d27e176e8344ea679813f.png host=www.friendiose.com request_id=d00190ed-d365-46aa-978d-53c0fed636f4 fwd="99.234.25.253" dyno=web.1 connect=3ms service=12ms status=200 bytes=30821
  2014-04-07T17:09:04.078418+00:00 heroku[run.8642]: State changed from up to complete
  2014-04-07T17:09:04.066492+00:00 heroku[run.8642]: Process exited with status 0
  2014-04-07T17:08:56.083949+00:00 heroku[router]: at=info method=GET path=/assets/place_map_icon-eea0b812cae352793b07d4cc9ab29ab6.png host=www.friendiose.com request_id=288b92d3-46fc-4d3c-a6c2-edcb1746aa7b fwd="99.234.25.253" dyno=web.1 connect=15ms service=37ms status=200 bytes=3282
  2014-04-07T17:08:55.818610+00:00 heroku[router]: at=info method=GET path=/assets/w_icon-b05939cd15957a224c909f4152f6de76.png host=www.friendiose.com request_id=8558679d-8b23-424a-b285-0a5756d637c9 fwd="99.234.25.253" dyno=web.1 connect=4ms service=9ms status=304 bytes=89
  2014-04-07T17:10:45.276715+00:00 app[web.1]: I, [2014-04-07T17:10:45.276355 #2]  INFO -- : Started GET "/activities/4" for 99.234.25.253 at 2014-04-07 17:10:45 +0000
  2014-04-07T17:10:45.276873+00:00 app[web.1]: I, [2014-04-07T17:10:45.276522 #2]  INFO -- : Started GET "/activities/4" for 99.234.25.253 at 2014-04-07 17:10:45 +0000
  </code></pre>