diff --git a/app/models/project.rb b/app/models/project.rb index dc1709d84..4fb022f0b 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -703,7 +703,7 @@ class Project < ActiveRecord::Base # or nil if the module is not enabled for the project def enabled_module(name) name = name.to_s - enabled_modules.detect {|m| m.name == name} + enabled_modules.find_by(name: name) end # Return true if the module with the given name is enabled @@ -986,7 +986,7 @@ class Project < ActiveRecord::Base new_issue.custom_field_values = issue.custom_field_values.inject({}) {|h,v| h[v.custom_field_id] = v.value; h} # Reassign fixed_versions by name, since names are unique per project if issue.fixed_version && issue.fixed_version.project == project - new_issue.fixed_version = self.versions.detect {|v| v.name == issue.fixed_version.name} + new_issue.fixed_version = self.versions.find_by(name: issue.fixed_version.name) end # Reassign version custom field values new_issue.custom_field_values.each do |custom_value|