Skip to content

Instantly share code, notes, and snippets.

@Mizpah
Created February 24, 2013 02:33
Show Gist options
  • Save Mizpah/5022328 to your computer and use it in GitHub Desktop.
Save Mizpah/5022328 to your computer and use it in GitHub Desktop.
I have a page with around 60 objects. Using Kaminari to create pagination. The first page example is the existing page. Everything in one table, and the columns have a sort link in the header. Th recipie for this was taken from a tutorial and adapted. I note that line '4' was explained as being 'critical to stop things breaking'. The second exam…
def index
@game_classes = GameClass.order("game_id").page(params[:page]).per(15)
@game_classes = GameClass.order(params[:sort]).page(params[:page]).per(15) if params[:sort]
#@game_classes = @game_classes.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @game_classes }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment