Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions app/models/node.rb
Original file line number Diff line number Diff line change
Expand Up @@ -526,15 +526,14 @@ def tagnames
tags.collect(&:name)
end

# Here we re-query to fetch /all/ tagnames; this is used in
# /views/notes/_notes.html.erb in a way that would otherwise only
# return a single tag due to a join, yet select() keeps this efficient
# Fetch all tagnames for this node directly, bypassing the `tag`
# association which may be filtered by a join in the calling context.
def tagnames_as_classes
Node.select([:nid])
.find(id)
.tagnames
.map { |t| 'tag-' + t.tr(':', '-') }
.join(' ')
Tag.joins(:node_tag)
.where('community_tags.nid = ?', nid)
.pluck(:name)
.map { |t| 'tag-' + t.tr(':', '-') }
.join(' ')
end

def edit_path
Expand Down
Loading