Skip to content
Snippets Groups Projects
Unverified Commit 1218bef4 authored by Sébastien Gaya's avatar Sébastien Gaya
Browse files

first or initialize in sync

parent 0b146a63
No related branches found
No related tags found
No related merge requests found
......@@ -45,7 +45,7 @@ class Communication::Website::Imported::Website < ApplicationRecord
def sync_media
wordpress.media.each do |data|
medium = media.where(university: university, identifier: data['id']).first_or_create
medium = media.where(university: university, identifier: data['id']).first_or_initialize
medium.data = data
medium.save
end
......@@ -53,7 +53,7 @@ class Communication::Website::Imported::Website < ApplicationRecord
def sync_pages
wordpress.pages.each do |data|
page = pages.where(university: university, identifier: data['id']).first_or_create
page = pages.where(university: university, identifier: data['id']).first_or_initialize
page.data = data
page.save
end
......@@ -70,7 +70,7 @@ class Communication::Website::Imported::Website < ApplicationRecord
def sync_posts
wordpress.posts.each do |data|
post = posts.where(university: university, identifier: data['id']).first_or_create
post = posts.where(university: university, identifier: data['id']).first_or_initialize
post.data = data
post.save
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment