Skip to content

Commit

Permalink
Refactor set_project method in staging controller
Browse files Browse the repository at this point in the history
find_by! is raising the ActiveRecord::RecordNotFound exception
when no record was found.

Co-authored-by: Dany Marcoux <dmarcoux@suse.com>
  • Loading branch information
bgeuken and Dany Marcoux committed Nov 14, 2018
1 parent 45216e7 commit c6295bb
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/api/app/controllers/staging/projects_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ class Staging::ProjectsController < ApplicationController
private

def set_project
@project = Staging::StagingProject.find_by(name: params[:project])
raise ActiveRecord::RecordNotFound unless @project
@project = Staging::StagingProject.find_by!(name: params[:project])
end
end

0 comments on commit c6295bb

Please sign in to comment.