2010-11-06 08:52:58 -07:00
|
|
|
class ContributionsController < ApplicationController
|
|
|
|
def index
|
2010-11-06 08:57:22 -07:00
|
|
|
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]
|
2013-01-25 13:23:48 -08:00
|
|
|
Contribution.preload_contributeds_and_parents(
|
|
|
|
@contributions,
|
|
|
|
:scopes => {
|
|
|
|
'Item' => Item.includes(:translations),
|
|
|
|
'PetType' => PetType.includes({:species => :translations,
|
|
|
|
:color => :translations})
|
|
|
|
}
|
|
|
|
)
|
2010-11-06 08:52:58 -07:00
|
|
|
end
|
|
|
|
end
|