module

ActionController::Route::Builder

helpers for defining routes with strong parameters

Constants

DEFAULT_PARSER = ["application/json"]

by default applications expect to receive JSON

DEFAULT_RESPONDER = ["application/json"]

by default applications respond with JSON

Macros

add_parser(content_type, &block)

add code that can be used to deserialise request bodies of the content-type provided

add_parser("application/yaml") do |klass, body_io, request|
  request_charset = ActionController::Support.charset(request.headers)
  body_io.set_encoding(request_charset) if request_charset
  klass.from_yaml(body_io)
end
Source
add_responder(content_type, &block)

add a new responder for the content-type provided, this will be called to render responses

add_responder("application/yaml") { |io, result| result.to_yaml(io) }
Source
default_parser(content_type)

specify the default content-type of request bodies, if the user doesn't specify one

Source
default_responder(content_type)

specify the responder content-type to use if the user doesn't request one

Source