# Manage event tags class TagsController < InheritedResources::Base has_scope :region, :locality, :daylimit has_scope :period, type: :hash, using: [:year, :week] has_scope :tag, as: :id def index @tags = apply_scopes(Event.moderated) .pluck(:tags).map(&:split).flatten .group_by { |i| i } .map { |k, v| [k, v.size] } .reject { |_k, v| v <= 3 } .sort respond_to do |format| format.html format.json { render json: @tags } end end def show @events_future = apply_scopes(Event).moderated.future @events_past = apply_scopes(Event).moderated.past end end