From f7ab63e0d3c8f2950d57a8d5f665545bd93ea87b Mon Sep 17 00:00:00 2001 From: Dan Elbert Date: Wed, 28 Sep 2016 17:28:40 -0500 Subject: [PATCH] Fied paging --- app/controllers/recipes_controller.rb | 2 ++ app/views/recipes/index.html.erb | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/controllers/recipes_controller.rb b/app/controllers/recipes_controller.rb index 62ceaff..fe4498d 100644 --- a/app/controllers/recipes_controller.rb +++ b/app/controllers/recipes_controller.rb @@ -7,6 +7,8 @@ class RecipesController < ApplicationController # GET /recipes def index @criteria = ViewModels::RecipeCriteria.new(params[:criteria]) + @criteria.page = params[:page] + @criteria.per = params[:per] @recipes = Recipe.for_criteria(@criteria) end diff --git a/app/views/recipes/index.html.erb b/app/views/recipes/index.html.erb index 39f3674..b97878d 100644 --- a/app/views/recipes/index.html.erb +++ b/app/views/recipes/index.html.erb @@ -9,9 +9,9 @@

No Recipes

<% else %> - <%= link_to 'New Recipe', new_recipe_path, class: 'btn btn-default' %> + <%= link_to 'New Recipe', new_recipe_path, class: 'btn btn-default' %>
- <%= paginate @recipes, :param_name => 'criteria[page]' %> + <%= paginate @recipes %>
@@ -61,7 +61,7 @@
- <%= paginate @recipes, :param_name => 'criteria[page]' %> + <%= paginate @recipes %> <% end %>