Skip to content

Commit

Permalink
fix ci standardrb issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Waishnav committed Aug 15, 2024
1 parent 3f221d7 commit 8c930f8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions app/controllers/simple_discussion/forum_threads_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,15 @@ def update
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
end
render :index
end

def destroy
@forum_thread.destroy!
redirect_to simple_discussion.forum_threads_path
Expand Down
4 changes: 2 additions & 2 deletions test/dummy/app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 8c930f8

Please sign in to comment.