0001-Handle-validation-errors-on-reverse-issue-relations.patch

Holger Just, 2017-12-01 16:45

Download (1.03 KB)

View differences:

app/controllers/issue_relations_controller.rb
46 46
    @relation.issue_from = @issue
47 47
    @relation.safe_attributes = params[:relation]
48 48
    @relation.init_journals(User.current)
49
    saved = @relation.save
49

  
50
    begin
51
      saved = @relation.save
52
    rescue ActiveRecord::RecordNotUnique
53
      saved = false
54
      @relation.errors.add :base, :taken
55
    end
50 56

  
51 57
    respond_to do |format|
52 58
      format.html { redirect_to issue_path(@issue) }
53
-