Skip to content

Commit

Permalink
[Refactor] Use ActiveRecord#find_by_id instead of #find and rescue.
Browse files Browse the repository at this point in the history
  • Loading branch information
timhabermaas committed Aug 16, 2015
1 parent 0ea1c9e commit d0426dc
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions app/controllers/work_packages/auto_completes_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,7 @@ def wp_hashes_with_string
def find_project
project_id = (params[:work_package] && params[:work_package][:project_id]) || params[:project_id]
return nil unless project_id
Project.find(project_id)
rescue ActiveRecord::RecordNotFound
nil
Project.find_by_id(project_id)
end

def determine_scope
Expand Down

0 comments on commit d0426dc

Please sign in to comment.