Module: DataTables::ActiveModelSerializers
- Defined in:
- lib/data_tables/active_model_serializers/adapter.rb,
lib/data_tables/active_model_serializers/adapter/pagination.rb,
lib/data_tables/active_model_serializers/register_dt_renderer.rb
Defined Under Namespace
Modules: ControllerSupport Classes: Adapter
Constant Summary collapse
- MEDIA_TYPE =
'application/json'.freeze
- HEADERS =
{ response: { 'CONTENT_TYPE'.freeze => MEDIA_TYPE }, request: { 'ACCEPT'.freeze => MEDIA_TYPE } }.freeze
Class Method Summary collapse
Class Method Details
.install ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/data_tables/active_model_serializers/register_dt_renderer.rb', line 21 def self.install # actionpack/lib/action_dispatch/http/mime_types.rb Mime::Type.register_alias MEDIA_TYPE, :dt, %w( text/plain text/x-json application/jsonrequest application/dt application/datatable ) # if Rails::VERSION::MAJOR >= 5 # ActionDispatch::Request.parameter_parsers[:dt] = parser # else # ActionDispatch::ParamsParser::DEFAULT_PARSERS[Mime[:dt]] = parser # end ::ActionController::Renderers.add :dt do |json, | json = serialize_dt(json, ).to_json() unless json.is_a?(String) self.content_type ||= Mime[:dt] self.response_body = json end end |