Skip to content

Commit

Permalink
Use an infinite sequence and save a query
Browse files Browse the repository at this point in the history
  • Loading branch information
knu committed Mar 16, 2017
1 parent 90dd0f7 commit c9f71ce
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/agent.rb
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ def build_clone(original)
new(original.slice(:type, :options, :service_id, :schedule, :controller_ids, :control_target_ids,
:source_ids, :keep_events_for, :propagate_immediately, :scenario_ids)) { |clone|
# Give it a unique name
2.upto(count) do |i|
2.step do |i|
name = '%s (%d)' % [original.name, i]
unless exists?(name: name)
clone.name = name
Expand Down

0 comments on commit c9f71ce

Please sign in to comment.