Sha256: e73780832587ea50580827acb5c849e1e6d962dfbbea0becf8c824df2d66c040

Contents?: true

Size: 521 Bytes

Versions: 10

Compression:

Stored size: 521 Bytes

Contents

# frozen_string_literal: true

module Talkie
  class MentionsController < TalkieController
    def index
      if query.size < 2
        render json: { error: 'Query string is too short (minimum 2 characters)' },
                       status: :unprocessable_entity
      else
        render json: MentioneesBlueprint.render(mentionees)
      end
    end

    private

    def query
      @query ||= params[:q].to_s
    end

    def mentionees
      @mentionees ||= current_user.class.mentionees(query)
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
talkie-0.5.1 app/controllers/talkie/mentions_controller.rb
talkie-0.5.0 app/controllers/talkie/mentions_controller.rb
talkie-0.4.1 app/controllers/talkie/mentions_controller.rb
talkie-0.4.0 app/controllers/talkie/mentions_controller.rb
talkie-0.3.5 app/controllers/talkie/mentions_controller.rb
talkie-0.3.4 app/controllers/talkie/mentions_controller.rb
talkie-0.3.3 app/controllers/talkie/mentions_controller.rb
talkie-0.3.2 app/controllers/talkie/mentions_controller.rb
talkie-0.3.1 app/controllers/talkie/mentions_controller.rb
talkie-0.3.0 app/controllers/talkie/mentions_controller.rb