File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -54,8 +54,19 @@ namespace :projects do
54
54
]
55
55
projects . each do |attributes |
56
56
identifier = attributes [ :identifier ]
57
- if Project . only_scratch ( true ) . exists? ( attributes . slice ( :identifier , :locale ) )
57
+ project = Project . only_scratch ( true ) . find_by ( attributes . slice ( :identifier , :locale ) )
58
+ if project . present?
58
59
puts "Scratch project with identifier '#{ identifier } ' already exists"
60
+ project . assign_attributes ( attributes . except ( :identifier , :locale ) )
61
+ if project . changed?
62
+ if project . save
63
+ puts "Scratch project with identifier '#{ identifier } ' updated successfully"
64
+ else
65
+ puts "Scratch project with identifier '#{ identifier } ' update failed"
66
+ end
67
+ else
68
+ puts "Scratch project with identifier '#{ identifier } ' has not changed"
69
+ end
59
70
elsif Project . create ( attributes )
60
71
puts "Scratch project with identifier '#{ identifier } ' created successfully"
61
72
else
You can’t perform that action at this time.
0 commit comments