Created
August 18, 2009 18:40
-
-
Save milandobrota/169874 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
item.categories.each do |rss_category| | |
rss_category.strip.split(',').each do |rss_category_split| | |
if rss_category_split | |
# Create the new category is necessary | |
category = Category.find_by_name(rss_category_split.strip) | |
if !category | |
# Try to find a merge category before creating a new category.x | |
categoryMerge = CategoryMerge.find_by_merge_src(rss_category_split.strip) | |
if categoryMerge | |
category = Category.find_by_id(categoryMerge.merge_target) | |
end | |
if !category | |
category = Category.new | |
category.name = rss_category_split.strip | |
end | |
end | |
new_feed_item.categories << category | |
end | |
end | |
end #each_with_index |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment