Skip to content

Commit dc7fba9

Browse files
Merge pull request #1207 from travis-ci/fix_same_name_branch_env_vars_am
[SUPP-105] Allow setting env vars with same name for different branches in v3 API
2 parents 2d5f2e8 + b54d6d3 commit dc7fba9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/travis/api/v3/models/env_var.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class Models::EnvVar < Travis::Settings::Model
1010
validates :name, presence: true
1111
validates_each :id, :name do |record, attr, value|
1212
others = record.repository.env_vars.select { |ev| ev.id != record.id }
13-
record.errors.add(:base, :duplicate_resource) if others.find { |ev| ev.send(attr) == record.send(attr) }
13+
record.errors.add(:base, :duplicate_resource) if others.find { |ev| ev.send(attr) == record.send(attr) && ev.send(:branch) == record.send(:branch) }
1414
end
1515

1616
def repository

0 commit comments

Comments
 (0)