1
0
Fork 0
forked from OpenNeo/impress
impress/app/controllers/contributions_controller.rb
Emi Matchu ce64f12cc3 Remove references to species/color translations at call sites
We wisely did preloading in some places. Now, we don't need to!
Hopefully this'll even be a free speed boost on some pages!
2024-01-23 05:23:57 -08:00

18 lines
538 B
Ruby

class ContributionsController < ApplicationController
def index
if params[:user_id]
@user = User.find params[:user_id]
@contributions = @user.contributions
else
@contributions = Contribution.includes(:user)
end
@contributions = @contributions.recent.paginate :page => params[:page]
Contribution.preload_contributeds_and_parents(
@contributions,
:scopes => {
'Item' => Item.includes(:translations),
'PetType' => PetType.includes(:species, :color)
}
)
end
end