Skip to content

Commit 7995b33

Browse files
committed
fixed category name search not working at all
1 parent 27048c4 commit 7995b33

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

app/controllers/categories_controller.rb

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,15 @@ class CategoriesController < ApplicationController
55
before_action :verify_view_access, except: [:index, :homepage, :new, :create, :post_types]
66

77
def index
8-
@categories = Category.accessible_to(current_user).all.order(sequence: :asc, id: :asc)
8+
@categories = if params[:term].present?
9+
Category.search(params[:term])
10+
else
11+
Category.all
12+
end
13+
14+
@categories = @categories.accessible_to(current_user)
15+
.order(sequence: :asc, id: :asc)
16+
917
respond_to do |format|
1018
format.html
1119
format.json do

0 commit comments

Comments
 (0)