Module: JqueryTablesorter::RailsUtils::Ajax::ActionController

Extended by:
ActiveSupport::Concern
Defined in:
lib/jquery-tablesorter/rails-utils/ajax/action_controller.rb

Instance Method Summary collapse

Instance Method Details

#create_query_html_response(base_query, partial: 'row') ⇒ Object

A generalized method to handle tablesorter queries. It’s meant to be used in the corresponding Controller action. Params: clazz: The model’s primary class base_query: If there are any relevant joins or so -> pass the AR relation here partial (optional): path to the partial to be rendered



16
17
18
19
20
21
22
23
# File 'lib/jquery-tablesorter/rails-utils/ajax/action_controller.rb', line 16

def create_query_html_response(base_query, partial: 'row')
  resp_data         = ts_ajax_handler.query_data(base_query)

  records           = resp_data.delete(:records)
  resp_data[:data]  = render_response_html(records, partial: partial)

  return resp_data
end