Created
April 20, 2010 17:07
-
-
Save mrkurt/372755 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#adds tags where categories don't match up | |
if data.has_key?('categories') | |
tags = data['tags'] || [] | |
placement_tags = [] | |
data['categories'].values.map{|c| c.split('/')}.flatten.each do |cat| | |
unless cat.empty? || tags.include?(cat) || placement_tags.include?(cat) | |
cat = '@' + cat | |
placement_tags << cat unless tags.include?(cat) || placement_tags.include?(cat) | |
end | |
end | |
data['tags'] = placement_tags + tags | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment