# Manage event tags class TagsController < InheritedResources::Base has_scope :region, :locality, :tag, :daylimit has_scope :period, type: :hash, using: [:year, :week] 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.tag params[:id] @events_past = apply_scopes(Event).moderated.past.tag params[:id] end end