Class: Effective::DatatablesController

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

Instance Method Summary collapse

Instance Method Details

#showObject



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

def show
  @datatable = Effective::Datatable.find(params[:id], params[:attributes])
  @datatable.view = view_context if @datatable.present?

  EffectiveDatatables.authorized?(self, :index, @datatable.try(:collection_class) || Effective::Datatable)

  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