Skip to content
Snippets Groups Projects
Commit 4e3b6d9b authored by Arnaud Levy's avatar Arnaud Levy
Browse files

post categories

parent 99bb4307
No related branches found
No related tags found
No related merge requests found
......@@ -35,8 +35,19 @@ class Api::Osuny::Communication::Websites::PostsController < Api::Osuny::Applica
end
def import_categories
categories.each do |category|
byebug
categories.each do |c|
data = c.to_unsafe_hash
if data.has_key? 'name'
category = website.categories.where(
university: current_university,
website: website,
name: data['name'],
language: website.default_language
).first_or_create
end
next if category.nil?
next if category.in?(post.categories)
post.categories << category
end
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