diff --git a/app/controllers/exercises_controller.rb b/app/controllers/exercises_controller.rb index 20c18f8e..a52d03a6 100644 --- a/app/controllers/exercises_controller.rb +++ b/app/controllers/exercises_controller.rb @@ -266,7 +266,7 @@ class ExercisesController < ApplicationController end def index - @search = policy_scope(Exercise).search(params[:q]) + @search = policy_scope(Exercise).ransack(params[:q]) @exercises = @search.result.includes(:execution_environment, :user).order(:title).paginate(page: params[:page]) authorize! end @@ -319,7 +319,7 @@ class ExercisesController < ApplicationController private :set_file_types def collect_set_and_unset_exercise_tags - @search = policy_scope(Tag).search(params[:q]) + @search = policy_scope(Tag).ransack(params[:q]) @tags = @search.result.order(:name) checked_exercise_tags = @exercise.exercise_tags checked_tags = checked_exercise_tags.collect{|e| e.tag}.to_set diff --git a/app/controllers/internal_users_controller.rb b/app/controllers/internal_users_controller.rb index 6779cff5..14078b8b 100644 --- a/app/controllers/internal_users_controller.rb +++ b/app/controllers/internal_users_controller.rb @@ -60,7 +60,7 @@ class InternalUsersController < ApplicationController end def index - @search = InternalUser.search(params[:q]) + @search = InternalUser.ransack(params[:q]) @users = @search.result.includes(:consumer).order(:name).paginate(page: params[:page]) authorize! end diff --git a/app/controllers/proxy_exercises_controller.rb b/app/controllers/proxy_exercises_controller.rb index b703488a..b5c7eccd 100644 --- a/app/controllers/proxy_exercises_controller.rb +++ b/app/controllers/proxy_exercises_controller.rb @@ -33,7 +33,7 @@ class ProxyExercisesController < ApplicationController end def edit - @search = policy_scope(Exercise).search(params[:q]) + @search = policy_scope(Exercise).ransack(params[:q]) @exercises = @search.result.order(:title) authorize! end @@ -44,14 +44,14 @@ class ProxyExercisesController < ApplicationController private :proxy_exercise_params def index - @search = policy_scope(ProxyExercise).search(params[:q]) + @search = policy_scope(ProxyExercise).ransack(params[:q]) @proxy_exercises = @search.result.order(:title).paginate(page: params[:page]) authorize! end def new @proxy_exercise = ProxyExercise.new - @search = policy_scope(Exercise).search(params[:q]) + @search = policy_scope(Exercise).ransack(params[:q]) @exercises = @search.result.order(:title) authorize! end @@ -63,8 +63,8 @@ class ProxyExercisesController < ApplicationController private :set_exercise_and_authorize def show - @search = @proxy_exercise.exercises.search - @exercises = @proxy_exercise.exercises.search.result.order(:title) #@search.result.order(:title) + @search = @proxy_exercise.exercises.ransack + @exercises = @proxy_exercise.exercises.ransack.result.order(:title) #@search.result.order(:title) end #we might want to think about auth here diff --git a/app/controllers/request_for_comments_controller.rb b/app/controllers/request_for_comments_controller.rb index 6f396d41..9a8e4656 100644 --- a/app/controllers/request_for_comments_controller.rb +++ b/app/controllers/request_for_comments_controller.rb @@ -15,7 +15,7 @@ class RequestForCommentsController < ApplicationController @search = RequestForComment .last_per_user(2) .with_last_activity - .search(params[:q]) + .ransack(params[:q]) @request_for_comments = @search.result .order('created_at DESC') .paginate(page: params[:page], total_entries: @search.result.length) @@ -27,7 +27,7 @@ class RequestForCommentsController < ApplicationController @search = RequestForComment .with_last_activity .where(user_id: current_user.id) - .search(params[:q]) + .ransack(params[:q]) @request_for_comments = @search.result .order('created_at DESC') .paginate(page: params[:page]) @@ -40,7 +40,7 @@ class RequestForCommentsController < ApplicationController .with_last_activity .joins(:comments) # we don't need to outer join here, because we know the user has commented on these .where(comments: {user_id: current_user.id}) - .search(params[:q]) + .ransack(params[:q]) @request_for_comments = @search.result .order('last_comment DESC') .paginate(page: params[:page]) diff --git a/app/controllers/study_groups_controller.rb b/app/controllers/study_groups_controller.rb index 54b4aa92..965fab4d 100644 --- a/app/controllers/study_groups_controller.rb +++ b/app/controllers/study_groups_controller.rb @@ -4,17 +4,17 @@ class StudyGroupsController < ApplicationController before_action :set_group, only: MEMBER_ACTIONS def index - @search = StudyGroup.search(params[:q]) + @search = StudyGroup.ransack(params[:q]) @study_groups = @search.result.includes(:consumer).order(:name).paginate(page: params[:page]) authorize! end def show - @search = @study_group.users.search(params[:q]) + @search = @study_group.users.ransack(params[:q]) end def edit - @search = @study_group.users.search(params[:q]) + @search = @study_group.users.ransack(params[:q]) @members = StudyGroupMembership.where(user: @search.result, study_group: @study_group) end diff --git a/app/controllers/submissions_controller.rb b/app/controllers/submissions_controller.rb index 57f3087d..23c977d3 100644 --- a/app/controllers/submissions_controller.rb +++ b/app/controllers/submissions_controller.rb @@ -106,7 +106,7 @@ class SubmissionsController < ApplicationController end def index - @search = Submission.search(params[:q]) + @search = Submission.ransack(params[:q]) @submissions = @search.result.includes(:exercise, :user).paginate(page: params[:page]) authorize! end