Class: UomsController

Inherits:
ApplicationController show all
Includes:
ApplicationHelper
Defined in:
app/controllers/uoms_controller.rb

Instance Method Summary collapse

Methods included from AuthentificationHelper

#accessible_company_ids_from_tenant_and_user, #application_mode_from_hostname, #current_company_id_from_accessible_company_ids, #current_tenant_from_user, #current_user_and_locale_from_token

Instance Method Details

#optionsObject



8
9
10
11
12
13
14
15
16
17
18
19
# File 'app/controllers/uoms_controller.rb', line 8

def options
  query = params[:query] || ''
  uom_options = UnitOfMeasurement
                .select(:unit_of_measurement_id, :code, :description)
                .where('description LIKE :query OR code LIKE :query', query: "%#{query}%")
                .order(:description)
                .limit(10)

  render json: {
    data: uom_options
  }
end