Class: Effective::DatatablesController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Effective::DatatablesController
- Defined in:
- app/controllers/effective/datatables_controller.rb
Instance Method Summary collapse
-
#show ⇒ Object
This will respond to both a GET and a POST.
Instance Method Details
#show ⇒ Object
This will respond to both a GET and a POST
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/controllers/effective/datatables_controller.rb', line 6 def show attributes = (params[:attributes].presence || {}).merge(referer: request.referer) scopes = (params[:scopes].presence || {}) @datatable = find_datatable(params[:id]).try(:new, attributes.merge(scopes)) @datatable.view = view_context if !@datatable.nil? EffectiveDatatables.(self, :index, @datatable.try(:collection_class) || @datatable.try(:class)) respond_to do |format| format.html format.json { if Rails.env.production? render :json => (@datatable.to_json rescue error_json) else render :json => @datatable.to_json end } end end |