Skip to content

Instantly share code, notes, and snippets.

@ehlyzov
Created July 7, 2014 09:50
Show Gist options
  • Select an option

  • Save ehlyzov/342dfbb03930c92ad69d to your computer and use it in GitHub Desktop.

Select an option

Save ehlyzov/342dfbb03930c92ad69d to your computer and use it in GitHub Desktop.
SEO-информация для категорий [tulp.ru]
parents = Category.where(parent_id: nil);
DUMP = -> (category) {
[
category.id,
category.name,
TulpSeo::Data.lookup(
"seo.info.categories.#{category.translit}.default",
{ city_parent: 'Санкт-Петербурга' }
)
]
};
CSV.open(Pathname.new('~/categories.csv').expand_path,'w') do |csv|
parents.each do |parent|
csv << DUMP[parent]
parent.children.each do |child|
csv << DUMP[child]
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment