diff --git a/app/controllers/simple_discussion/forum_threads_controller.rb b/app/controllers/simple_discussion/forum_threads_controller.rb index 560a0df..cc2f669 100644 --- a/app/controllers/simple_discussion/forum_threads_controller.rb +++ b/app/controllers/simple_discussion/forum_threads_controller.rb @@ -74,8 +74,8 @@ def destroy def search if params[:query].present? @forum_threads = topic_search(params[:query]) - .includes(:user, :forum_category) - .paginate(per_page: 10, page: page_number) + .includes(:user, :forum_category) + .paginate(per_page: 10, page: page_number) else index return diff --git a/test/dummy/app/helpers/application_helper.rb b/test/dummy/app/helpers/application_helper.rb index a190c28..249c1ee 100644 --- a/test/dummy/app/helpers/application_helper.rb +++ b/test/dummy/app/helpers/application_helper.rb @@ -2,7 +2,7 @@ module ApplicationHelper # simple sql query implementation of basic_search, this helper method can be complex as it you wanted it to be def topic_search(query) ForumThread.joins(:forum_posts) - .where("forum_threads.title LIKE :query OR forum_posts.body LIKE :query", query: "%#{query}%") - .distinct + .where("forum_threads.title LIKE :query OR forum_posts.body LIKE :query", query: "%#{query}%") + .distinct end end