Sha256: 9b6a562fe05bf2cbb53166b99c2de897c6f5b6b3ec9a536fb9aed5a6ad7cd9f4

Contents?: true

Size: 507 Bytes

Versions: 54

Compression:

Stored size: 507 Bytes

Contents

# frozen_string_literal: true

module Motor
  class UsersForAutocompleteController < ApiBaseController
    def index
      authorize!(:create, Motor::Note)

      render json: { data: user_emails }
    end

    private

    def user_emails
      user_class   = Motor::AdminUser if defined?(Motor::AdminUser)
      user_class ||= AdminUser if defined?(AdminUser)
      user_class ||= User if defined?(User)

      return user_class.distinct.limit(100).pluck(:email) if user_class

      []
    end
  end
end

Version data entries

54 entries across 54 versions & 6 rubygems

Version Path
motor-admin-0.4.34 app/controllers/motor/users_for_autocomplete_controller.rb
motor-admin-0.4.33 app/controllers/motor/users_for_autocomplete_controller.rb
motor-admin-0.4.32 app/controllers/motor/users_for_autocomplete_controller.rb
motor-admin-0.4.31 app/controllers/motor/users_for_autocomplete_controller.rb
motor-admin-0.4.30 app/controllers/motor/users_for_autocomplete_controller.rb
motor-admin-0.4.29 app/controllers/motor/users_for_autocomplete_controller.rb
motor-admin-0.4.28 app/controllers/motor/users_for_autocomplete_controller.rb
motor-admin-cstham8-0.4.35 app/controllers/motor/users_for_autocomplete_controller.rb
motor-admin-cstham8-0.4.34 app/controllers/motor/users_for_autocomplete_controller.rb
motor-admin-cstham8-0.4.33 app/controllers/motor/users_for_autocomplete_controller.rb
motor-admin-cstham8-0.4.32 app/controllers/motor/users_for_autocomplete_controller.rb
motor-admin-cstham8-0.4.31 app/controllers/motor/users_for_autocomplete_controller.rb
motor-admin-cstham8-0.4.30 app/controllers/motor/users_for_autocomplete_controller.rb
motor-admin-cstham8-0.4.29 app/controllers/motor/users_for_autocomplete_controller.rb
motor-admin-cstham8-0.4.28 app/controllers/motor/users_for_autocomplete_controller.rb
motor-admin-cstham8-0.4.27 app/controllers/motor/users_for_autocomplete_controller.rb
motor-admin-0.4.27 app/controllers/motor/users_for_autocomplete_controller.rb
motor-admin-unosquare-0.4.28 app/controllers/motor/users_for_autocomplete_controller.rb
motor-admin-unosquare-0.4.27 app/controllers/motor/users_for_autocomplete_controller.rb
motor-admin-pz-0.4.26 app/controllers/motor/users_for_autocomplete_controller.rb