Sha256: 96b682e8a740a3831c930c3fb49ae3a5a4480ca79d4465f15307cac16b79d5d8

Contents?: true

Size: 499 Bytes

Versions: 4

Compression:

Stored size: 499 Bytes

Contents

# TODO: Move to Georgia::Indexer
module Georgia
  module Api
    class TagsController < Georgia::ApplicationController

      respond_to :json

      def search
        @search = ActsAsTaggableOn::Tag.search do
          fulltext params[:q] do
            fields(:name)
          end
          paginate(page: 1, per_page: 10)
        end
        # Format for select2
        @tags = @search.results.map{|t| {id: t.id, text: t.name}}

        respond_with(results: @tags)
      end

    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
georgia-0.7.6 app/controllers/georgia/api/tags_controller.rb
georgia-0.7.5 app/controllers/georgia/api/tags_controller.rb
georgia-0.7.4 app/controllers/georgia/api/tags_controller.rb
georgia-0.7.3 app/controllers/georgia/api/tags_controller.rb