Skip to content

Commit e67a2fa

Browse files
committed
#395 dojo_event_services:upsert で、URL のみ異なる dojo_event_services を二重登録しないよう修正
1 parent d30708b commit e67a2fa

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/tasks/dojo_event_services.rake

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@ namespace :dojo_event_services do
1616
result[:skipped] << [des['dojo_id'], 'Not found record in `dojos` table']
1717
next
1818
end
19-
19+
# 比較対象は URL を除く dojo_id, name, group_id
20+
url = des.delete('url')
2021
dojo_event_service = dojo.dojo_event_services.find_or_initialize_by(des)
22+
dojo.dojo_event_services.where(des).where.not(id: dojo_event_service.id).destroy_all
2123
if dojo_event_service.changed?
2224
changes = dojo_event_service.changes
2325
new_record = dojo_event_service.new_record?

0 commit comments

Comments
 (0)