summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Barbosa Alexandre <dbalexandre@gmail.com>2016-10-11 14:13:26 -0300
committerDouglas Barbosa Alexandre <dbalexandre@gmail.com>2016-10-19 14:58:26 -0200
commit2deef25eb0c87db2fddf8b25c95891650d9c43a7 (patch)
tree74151eff9a7fa355d53bcfb09a466c8fd209dfe2
parentbdf365e64f35e76ba6d9a372111ce502db11827e (diff)
downloadgitlab-ce-2deef25eb0c87db2fddf8b25c95891650d9c43a7.tar.gz
Use Label.attributes instead of Label.dup when creating label templates
-rw-r--r--app/models/project.rb7
1 files changed, 1 insertions, 6 deletions
diff --git a/app/models/project.rb b/app/models/project.rb
index a04817987b4..7ab624eafdf 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -733,12 +733,7 @@ class Project < ActiveRecord::Base
def create_labels
Label.templates.each do |label|
- label = label.dup
- label.template = false
- label.project_id = self.id
- label.type = 'ProjectLabel'
-
- label.save
+ self.labels.create!(label.attributes.symbolize_keys.except(:id, :template))
end
end