hopsoft / tag_columns

Fast & simple Rails ActiveRecord model tagging using PostgreSQL's Array datatype
MIT License
52 stars 3 forks source link

tag cloud #4

Closed leastbad closed 4 years ago

leastbad commented 4 years ago

This patch adds a singleton method to the model class which supports generating an array of weighted arrays, tallying unique values present on the table.

`Post.keywords_cloud`

results in: [["DOM", 1], ["actioncable", 1], ["ajax", 2], ["app-bridge", 1], ["binding", 1], ["bootstrap", 1], ["bulma", 1], ["cable", 1], ["check-all", 1], ["checkbox", 1], ["commands", 1], ["components", 3], ["controller", 11]]

Method supports AR scopes, similar to Post.unique_keywords.

coveralls commented 4 years ago

Coverage Status

Coverage decreased (-0.9%) to 12.698% when pulling 60c276f6e22a6e726e69418dff5529e7c9b1583b on leastbad:tag_cloud into b760886efc737773edc2bb9fb2d1b6812d8011a0 on hopsoft:master.