Serialize youtube titles to yaml to ActiveRecord can read them
This commit is contained in:
parent
f79c08b235
commit
b42bffa6fa
1 changed files with 14 additions and 2 deletions
|
|
@ -85,7 +85,13 @@ module DataConversion
|
|||
|
||||
def comments_json_to_csv model_hash
|
||||
generic_json_to_csv(model_hash) do |hash|
|
||||
model_hash[:mongo_attrs].map { |attr_name| hash[attr_name] }
|
||||
model_hash[:mongo_attrs].map { |attr_name|
|
||||
if attr_name == "youtube_titles"
|
||||
hash[attr_name].to_yaml
|
||||
else
|
||||
hash[attr_name]
|
||||
end
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -155,7 +161,13 @@ module DataConversion
|
|||
|
||||
def posts_json_to_csv model_hash
|
||||
generic_json_to_csv(model_hash) do |hash|
|
||||
model_hash[:mongo_attrs].map { |attr_name| hash[attr_name] }
|
||||
model_hash[:mongo_attrs].map { |attr_name|
|
||||
if attr_name == "youtube_titles"
|
||||
hash[attr_name].to_yaml
|
||||
else
|
||||
hash[attr_name]
|
||||
end
|
||||
}
|
||||
end
|
||||
#has to handle the polymorphic stuff
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue