Commit e2a437f724e89de22fa4257ef588ed24f4021cee
1 parent
75a35fb9
Exists in
master
and in
22 other branches
ActionItem1026: ask the environment for its tags
Showing
2 changed files
with
4 additions
and
2 deletions
Show diff stats
app/controllers/public/search_controller.rb
... | ... | @@ -209,14 +209,14 @@ class SearchController < PublicController |
209 | 209 | attr_reader :category |
210 | 210 | |
211 | 211 | def tags |
212 | - @tags = Tag.find(:all).inject({}) do |memo,tag| | |
212 | + @tags = environment.tags.inject({}) do |memo,tag| | |
213 | 213 | memo[tag.name] = tag.taggings.count |
214 | 214 | memo |
215 | 215 | end |
216 | 216 | end |
217 | 217 | |
218 | 218 | def tag |
219 | - @tag = Tag.find_by_name(params[:tag]) | |
219 | + @tag = environment.tags.find_by_name(params[:tag]) | |
220 | 220 | @tagged = @tag.taggings.map(&:taggable) |
221 | 221 | end |
222 | 222 | ... | ... |
app/models/environment.rb
... | ... | @@ -444,6 +444,8 @@ class Environment < ActiveRecord::Base |
444 | 444 | |
445 | 445 | has_many :events, :through => :profiles, :source => :articles, :class_name => 'Event' |
446 | 446 | |
447 | + has_many :tags, :through => :articles | |
448 | + | |
447 | 449 | def theme |
448 | 450 | self[:theme] || 'default' |
449 | 451 | end | ... | ... |