Class: Avo::SearchController

Inherits:
ApplicationController show all
Defined in:
app/controllers/avo/search_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#_current_user, #check_avo_license, #context, #exception_logger, #init_app, #render, #turbo_frame_request?

Methods included from UrlHelpers

#edit_resource_path, #new_resource_path, #related_resources_path, #resource_attach_path, #resource_detach_path, #resource_path, #resource_view_path, #resources_path

Methods included from ApplicationHelper

#a_button, #a_link, #button_classes, #empty_state, #get_model_class, #input_classes, #render_license_warning, #render_license_warnings, #root_path_without_url, #svg

Instance Method Details

#indexObject

Raises:

  • (ActionController::BadRequest)


10
11
12
13
14
15
16
17
18
# File 'app/controllers/avo/search_controller.rb', line 10

def index
  raise ActionController::BadRequest.new("This feature requires the pro license https://avohq.io/purchase/pro") if App.license.lacks_with_trial(:global_search)

  resources = Avo::App.resources.reject do |resource|
    resource.class.hide_from_global_search
  end

  render json: search_resources(resources)
end

#showObject



20
21
22
# File 'app/controllers/avo/search_controller.rb', line 20

def show
  render json: search_resources([resource])
end