Commit 74d6b83

mo khan <mo@mokhan.ca>
2017-02-26 03:35:24
find by username.
1 parent a953f1a
Changed files (2)
app
controllers
views
app/controllers/charts_controller.rb
@@ -23,6 +23,6 @@ class ChartsController < ApplicationController
   end
 
   def user
-    User.find_by(id: params[:user_id]) || current_user
+    User.find_by(username: params[:username]) || current_user
   end
 end
app/views/profiles/show.html.erb
@@ -26,7 +26,7 @@
           <% personal_record = history.personal_record %>
           <div class="level-item has-text-centered">
             <div>
-              <p class="heading"><%= link_to history.exercise.name, charts_path(exercise: history.exercise, user_id: @user), remote: true %></p>
+              <p class="heading"><%= link_to history.exercise.name, charts_path(exercise: history.exercise, username: @user), remote: true %></p>
               <p class="title"><%= personal_record ? "#{personal_record} lbs" : t('.not_available') %></p>
             </div>
           </div>