Upgrade Ransack #search to #ransack to prevent deprecation warning
This commit is contained in:
@ -266,7 +266,7 @@ class ExercisesController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def index
|
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])
|
@exercises = @search.result.includes(:execution_environment, :user).order(:title).paginate(page: params[:page])
|
||||||
authorize!
|
authorize!
|
||||||
end
|
end
|
||||||
@ -319,7 +319,7 @@ class ExercisesController < ApplicationController
|
|||||||
private :set_file_types
|
private :set_file_types
|
||||||
|
|
||||||
def collect_set_and_unset_exercise_tags
|
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)
|
@tags = @search.result.order(:name)
|
||||||
checked_exercise_tags = @exercise.exercise_tags
|
checked_exercise_tags = @exercise.exercise_tags
|
||||||
checked_tags = checked_exercise_tags.collect{|e| e.tag}.to_set
|
checked_tags = checked_exercise_tags.collect{|e| e.tag}.to_set
|
||||||
|
@ -60,7 +60,7 @@ class InternalUsersController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@search = InternalUser.search(params[:q])
|
@search = InternalUser.ransack(params[:q])
|
||||||
@users = @search.result.includes(:consumer).order(:name).paginate(page: params[:page])
|
@users = @search.result.includes(:consumer).order(:name).paginate(page: params[:page])
|
||||||
authorize!
|
authorize!
|
||||||
end
|
end
|
||||||
|
@ -33,7 +33,7 @@ class ProxyExercisesController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def edit
|
def edit
|
||||||
@search = policy_scope(Exercise).search(params[:q])
|
@search = policy_scope(Exercise).ransack(params[:q])
|
||||||
@exercises = @search.result.order(:title)
|
@exercises = @search.result.order(:title)
|
||||||
authorize!
|
authorize!
|
||||||
end
|
end
|
||||||
@ -44,14 +44,14 @@ class ProxyExercisesController < ApplicationController
|
|||||||
private :proxy_exercise_params
|
private :proxy_exercise_params
|
||||||
|
|
||||||
def index
|
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])
|
@proxy_exercises = @search.result.order(:title).paginate(page: params[:page])
|
||||||
authorize!
|
authorize!
|
||||||
end
|
end
|
||||||
|
|
||||||
def new
|
def new
|
||||||
@proxy_exercise = ProxyExercise.new
|
@proxy_exercise = ProxyExercise.new
|
||||||
@search = policy_scope(Exercise).search(params[:q])
|
@search = policy_scope(Exercise).ransack(params[:q])
|
||||||
@exercises = @search.result.order(:title)
|
@exercises = @search.result.order(:title)
|
||||||
authorize!
|
authorize!
|
||||||
end
|
end
|
||||||
@ -63,8 +63,8 @@ class ProxyExercisesController < ApplicationController
|
|||||||
private :set_exercise_and_authorize
|
private :set_exercise_and_authorize
|
||||||
|
|
||||||
def show
|
def show
|
||||||
@search = @proxy_exercise.exercises.search
|
@search = @proxy_exercise.exercises.ransack
|
||||||
@exercises = @proxy_exercise.exercises.search.result.order(:title) #@search.result.order(:title)
|
@exercises = @proxy_exercise.exercises.ransack.result.order(:title) #@search.result.order(:title)
|
||||||
end
|
end
|
||||||
|
|
||||||
#we might want to think about auth here
|
#we might want to think about auth here
|
||||||
|
@ -15,7 +15,7 @@ class RequestForCommentsController < ApplicationController
|
|||||||
@search = RequestForComment
|
@search = RequestForComment
|
||||||
.last_per_user(2)
|
.last_per_user(2)
|
||||||
.with_last_activity
|
.with_last_activity
|
||||||
.search(params[:q])
|
.ransack(params[:q])
|
||||||
@request_for_comments = @search.result
|
@request_for_comments = @search.result
|
||||||
.order('created_at DESC')
|
.order('created_at DESC')
|
||||||
.paginate(page: params[:page], total_entries: @search.result.length)
|
.paginate(page: params[:page], total_entries: @search.result.length)
|
||||||
@ -27,7 +27,7 @@ class RequestForCommentsController < ApplicationController
|
|||||||
@search = RequestForComment
|
@search = RequestForComment
|
||||||
.with_last_activity
|
.with_last_activity
|
||||||
.where(user_id: current_user.id)
|
.where(user_id: current_user.id)
|
||||||
.search(params[:q])
|
.ransack(params[:q])
|
||||||
@request_for_comments = @search.result
|
@request_for_comments = @search.result
|
||||||
.order('created_at DESC')
|
.order('created_at DESC')
|
||||||
.paginate(page: params[:page])
|
.paginate(page: params[:page])
|
||||||
@ -40,7 +40,7 @@ class RequestForCommentsController < ApplicationController
|
|||||||
.with_last_activity
|
.with_last_activity
|
||||||
.joins(:comments) # we don't need to outer join here, because we know the user has commented on these
|
.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})
|
.where(comments: {user_id: current_user.id})
|
||||||
.search(params[:q])
|
.ransack(params[:q])
|
||||||
@request_for_comments = @search.result
|
@request_for_comments = @search.result
|
||||||
.order('last_comment DESC')
|
.order('last_comment DESC')
|
||||||
.paginate(page: params[:page])
|
.paginate(page: params[:page])
|
||||||
|
@ -4,17 +4,17 @@ class StudyGroupsController < ApplicationController
|
|||||||
before_action :set_group, only: MEMBER_ACTIONS
|
before_action :set_group, only: MEMBER_ACTIONS
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@search = StudyGroup.search(params[:q])
|
@search = StudyGroup.ransack(params[:q])
|
||||||
@study_groups = @search.result.includes(:consumer).order(:name).paginate(page: params[:page])
|
@study_groups = @search.result.includes(:consumer).order(:name).paginate(page: params[:page])
|
||||||
authorize!
|
authorize!
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
@search = @study_group.users.search(params[:q])
|
@search = @study_group.users.ransack(params[:q])
|
||||||
end
|
end
|
||||||
|
|
||||||
def edit
|
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)
|
@members = StudyGroupMembership.where(user: @search.result, study_group: @study_group)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ class SubmissionsController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@search = Submission.search(params[:q])
|
@search = Submission.ransack(params[:q])
|
||||||
@submissions = @search.result.includes(:exercise, :user).paginate(page: params[:page])
|
@submissions = @search.result.includes(:exercise, :user).paginate(page: params[:page])
|
||||||
authorize!
|
authorize!
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user