Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ GEM
lint_roller (~> 1.1)
rubocop (>= 1.75.0, < 2.0)
rubocop-ast (>= 1.47.1, < 2.0)
rubocop-rails (2.34.3)
rubocop-rails (2.35.3)
activesupport (>= 4.2.0)
lint_roller (~> 1.1)
rack (>= 1.1)
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/admin/projects_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def scoped_resource
end

def destroy_image
image = requested_resource.images.find(params[:image_id])
image = requested_resource.images.find(params.expect(:image_id))
image.purge
redirect_back_or_to(requested_resource)
end
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/api/feedback_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def create
end

def set_read
feedback = Feedback.find(params[:id])
feedback = Feedback.find(params.expect(:id))
result = Feedback::SetRead.call(feedback: feedback)

if result.success?
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/api/join_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def create
private

def find_school_and_class
@school_class = SchoolClass.find_by!(join_code: JoinCodeGenerator.normalize(params[:join_code]))
@school_class = SchoolClass.find_by!(join_code: JoinCodeGenerator.normalize(params.expect(:join_code)))
@school = @school_class.school
end

Expand Down
4 changes: 2 additions & 2 deletions app/controllers/api/projects/images_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ class ImagesController < ApiController
before_action :authorize_user, only: %i[create]

def show
@project = Project.find_by!(identifier: params[:project_id])
@project = Project.find_by!(identifier: params.expect(:project_id))
authorize! :show, @project
render '/api/projects/images', formats: [:json]
end

def create
@project = Project.find_by!(identifier: params[:project_id])
@project = Project.find_by!(identifier: params.expect(:project_id))
authorize! :update, @project
@project.images.attach(params[:images])
render '/api/projects/images', formats: [:json]
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/api/projects/remixes_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def create
private

def project
@project ||= Project.find_by!(identifier: params[:project_id])
@project ||= Project.find_by!(identifier: params.expect(:project_id))
end

def load_and_authorize_remix
Expand Down
14 changes: 7 additions & 7 deletions app/controllers/api/school_classes_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def import
end

def update
school_class = @school.classes.find(params[:id])
school_class = @school.classes.find(params.expect(:id))
result = SchoolClass::Update.call(school_class:, school_class_params:)

if result.success?
Expand Down Expand Up @@ -176,25 +176,25 @@ def assign_students_to_class(school_class, school_students)
end

def load_and_authorize_school
@school = if params[:school_id].match?(/\d\d-\d\d-\d\d/)
@school = if params.expect(:school_id).match?(/\d\d-\d\d-\d\d/)
School.find_by(code: params[:school_id])
else
School.find(params[:school_id])
School.find(params.expect(:school_id))
end
authorize! :read, @school
end

def load_and_authorize_school_class
if %w[index create import].include?(params[:action])
authorize! params[:action].to_sym, SchoolClass
authorize! params.expect(:action).to_sym, SchoolClass
else
@school_class = if params[:id].match?(/\d\d-\d\d-\d\d/)
@school_class = if params.expect(:id).match?(/\d\d-\d\d-\d\d/)
@school.classes.find_by(code: params[:id])
else
@school.classes.find(params[:id])
@school.classes.find(params.expect(:id))
end

authorize! params[:action].to_sym, @school_class
authorize! params.expect(:action).to_sym, @school_class
end
end

Expand Down
2 changes: 1 addition & 1 deletion app/controllers/api/school_projects_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def set_finished
private

def project
@project ||= Project.find_by!(identifier: params[:id])
@project ||= Project.find_by!(identifier: params.expect(:id))
end

def school_project
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/api/schools_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def create
end

def update
school = School.find(params[:id])
school = School.find(params.expect(:id))
result = School::Update.call(school:, school_params: update_params)

if result.success?
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/api/scratch/projects_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def move_pending_scratch_upload_to_remix(pending_upload, remix_project)
end

def load_project
@project = Project.find_by!(identifier: params[:id], project_type: Project::Types::CODE_EDITOR_SCRATCH)
@project = Project.find_by!(identifier: params.expect(:id), project_type: Project::Types::CODE_EDITOR_SCRATCH)
end
end
end
Expand Down
Loading