Skip to content

Instantly share code, notes, and snippets.

@jywarren
Last active January 16, 2019 15:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jywarren/07f598cca34bdc2f8042236b83f02b10 to your computer and use it in GitHub Desktop.
Save jywarren/07f598cca34bdc2f8042236b83f02b10 to your computer and use it in GitHub Desktop.
time = Time.now
tags = {}
Tag.order(count: :desc).limit(250).each do |tag|
tags[tag.name] = Tag.related(tag.name).collect(&:name)
end
tags.to_json
(Time.now - time).to_s # time passed in seconds - ~8-11 seconds, potentially longer without caching
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment