Sha256: 45fa65bf15d26a7cb162cf91557999f1b4ab5ec2d5d76a2d422088dd7fe5370b
Contents?: true
Size: 650 Bytes
Versions: 25
Compression:
Stored size: 650 Bytes
Contents
class TagsController < ApplicationController before_filter :authenticate_user! def index @tags = case params[:mode] when "popular" most_popular else match_tag end if @tags.blank? && params[:q].present? @tags = [ ActsAsTaggableOn::Tag.new(name: params[:q]) ] end respond_to do |format| format.json { render json: @tags } end end private def match_tag ActsAsTaggableOn::Tag.where('name LIKE ?',"%#{ params[:q] }%").page(params[:page]) end def most_popular ActivityObject.tag_counts(:order => "count desc").page(params[:page]) end end
Version data entries
25 entries across 25 versions & 2 rubygems