mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-03-25 01:14:43 +00:00
Remove caching for school show view and eager load correctly
Could not do the caching properly with action buttons having permissions associated. The caching method was being called for every wrestler and took 150ms
This commit is contained in:
@@ -69,7 +69,7 @@ class SchoolsController < ApplicationController
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_school
|
||||
@school = School.where(:id => params[:id]).includes(:tournament,:wrestlers,:deductedPoints).first
|
||||
@school = School.where(:id => params[:id]).includes(:tournament,:wrestlers,:deductedPoints,:delegates).first
|
||||
end
|
||||
|
||||
# Never trust parameters from the scary internet, only allow the white list through.
|
||||
|
||||
@@ -51,7 +51,6 @@
|
||||
|
||||
<tbody>
|
||||
<% @wrestlers.sort_by{|w| w.weight.max}.each do |wrestler| %>
|
||||
<% cache ["schools_view_wrestler", wrestler] do %>
|
||||
<tr>
|
||||
<td><%= wrestler.name %></td>
|
||||
<td><%= wrestler.weight.max %></td>
|
||||
@@ -63,7 +62,6 @@
|
||||
Yes
|
||||
<% end %></td>
|
||||
<td><%= wrestler.nextMatchBoutNumber %> <%= wrestler.nextMatchMatName %></td>
|
||||
<% end %>
|
||||
<td>
|
||||
<%= link_to 'Show', wrestler , :class=>"btn btn-default btn-sm" %>
|
||||
<% if can? :manage, wrestler.school %>
|
||||
|
||||
Reference in New Issue
Block a user