Skip to content

Commit

Permalink
Assign page params to a variable
Browse files Browse the repository at this point in the history
  • Loading branch information
mercyoseni committed Jul 29, 2019
1 parent 5b3db35 commit 02ab481
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions app/controllers/mushrooms_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ class MushroomsController < ApplicationController

def index
@mushrooms = []
page = params[:page]

if search_query.present?
@mushrooms = SearchMushroom.new(search_query, params[:page]).run
@mushrooms = SearchMushroom.new(search_query, page).run
end

if params[:filter].present?
@mushrooms = FilterMushroom.new(params[:filter], params[:page]).run
@mushrooms = FilterMushroom.new(params[:filter], page).run
end
end
end

0 comments on commit 02ab481

Please sign in to comment.