Skip to content
This repository has been archived by the owner on Jul 15, 2021. It is now read-only.

Commit

Permalink
Fix pagination on given/received compliments
Browse files Browse the repository at this point in the history
Didn't realize these used the index view too.
  • Loading branch information
olivierlacan committed Aug 11, 2017
1 parent e1d751f commit 660ace3
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions app/controllers/compliments_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,26 @@ def index
end

def given
@compliments = current_user.compliments_given
@compliments = current_user.compliments_given.
paginate(page: params[:page], per_page: 30)

render :index
end

def received
@compliments = current_user.compliments_received
respond_to do |format|
format.html do
@compliments = current_user.compliments_received.
paginate(page: params[:page], per_page: 30)

render :index
end
format.csv do
@compliments = current_user.compliments_received
headers['Content-Disposition'] = "attachment; filename=\"compliments.csv\""
headers['Content-Type'] ||= 'text/csv'
@headers = ['From', 'To', "Compliment", "When"]
@headers = ["From", "To", "Compliment", "When"]

render :index
end
end
Expand Down

0 comments on commit 660ace3

Please sign in to comment.