impress/app/controllers/contributions_controller.rb

19 lines
538 B
Ruby
Raw Normal View History

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]
Contribution.preload_contributeds_and_parents(
@contributions,
:scopes => {
'Item' => Item.includes(:translations),
'PetType' => PetType.includes(:species, :color)
}
)
2010-11-06 08:52:58 -07:00
end
end