Sha256: e11d19017056873f2e97620d8dbf975a868616a78a88da934eb15be955f4fedd

Contents?: true

Size: 466 Bytes

Versions: 3

Compression:

Stored size: 466 Bytes

Contents

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

3 entries across 3 versions & 1 rubygems

Version Path
georgia-0.7.2 app/controllers/georgia/api/tags_controller.rb
georgia-0.7.1 app/controllers/georgia/api/tags_controller.rb
georgia-0.7.0 app/controllers/georgia/api/tags_controller.rb