Class: DatatablesController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/datatables_controller.rb

Instance Method Summary collapse

Instance Method Details

#datasetObject



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

def dataset
  begin
    model_class = params[:model].classify.constantize
  rescue NameError
    render :text => 'Model Not Found', :layout => false
    return
  end
  
  output = model_class.datatable(params)
  
  # Render Encoded JSON
  render :text => output.to_json, :layout => false
end