Project

General

Profile

Patch #26721 » project.rb.2.diff

jwjw yy, 2017-08-19 05:27

View differences:

app/models/project.rb
703 703
  # or nil if the module is not enabled for the project
704 704
  def enabled_module(name)
705 705
    name = name.to_s
706
    enabled_modules.detect {|m| m.name == name}
706
    enabled_modules.find_by(name: name)
707 707
  end
708 708

  
709 709
  # Return true if the module with the given name is enabled
......
986 986
      new_issue.custom_field_values = issue.custom_field_values.inject({}) {|h,v| h[v.custom_field_id] = v.value; h}
987 987
      # Reassign fixed_versions by name, since names are unique per project
988 988
      if issue.fixed_version && issue.fixed_version.project == project
989
        new_issue.fixed_version = self.versions.detect {|v| v.name == issue.fixed_version.name}
989
          new_issue.fixed_version = self.versions.find_by(name: issue.fixed_version.name)
990 990
      end
991 991
      # Reassign version custom field values
992 992
      new_issue.custom_field_values.each do |custom_value|
(2-2/3)