diff options
| author | mo khan <mo@mokhan.ca> | 2014-10-31 22:28:19 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2014-10-31 22:28:19 -0600 |
| commit | e101280c53afc76259180e9d98885ff7fc55a280 (patch) | |
| tree | 31d66d26055245689bb8e7a9a78ee5d4cc96fa06 /app/models | |
| parent | 691dabbc39ad6f260bd3597a89c7626a32e2f558 (diff) | |
render all tags and tools in dashboard.
Diffstat (limited to 'app/models')
| -rw-r--r-- | app/models/tag.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/app/models/tag.rb b/app/models/tag.rb new file mode 100644 index 00000000..66df3236 --- /dev/null +++ b/app/models/tag.rb @@ -0,0 +1,19 @@ +class Tag + def self.unique_tools + ActsAsTaggableOn::Tag + .joins(:taggings) + .where(taggings: { context: 'tools' }) + .order(:name) + .pluck(:name) + .uniq + end + + def self.unique_tags + ActsAsTaggableOn::Tag + .joins(:taggings) + .where(taggings: { context: 'tags' }) + .order(:name) + .pluck(:name) + .uniq + end +end |
