module ActionController::Route::Builder
Overview
helpers for defining routes with strong parameters
Direct including types
Defined in:
action-controller/router/builder.crConstant Summary
-
DEFAULT_PARSER =
["application/json"]
-
by default applications expect to receive JSON
-
DEFAULT_RESPONDER =
["application/json"]
-
by default applications respond with JSON
Macro Summary
-
add_parser(content_type, &block)
add code that can be used to deserialise request bodies of the content-type provided
-
add_responder(content_type, &block)
add a new responder for the content-type provided, this will be called to render responses
-
default_parser(content_type)
specify the default content-type of request bodies, if the user doesn't specify one
-
default_responder(content_type)
specify the responder content-type to use if the user doesn't request one
Macro Detail
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
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) }
specify the default content-type of request bodies, if the user doesn't specify one
specify the responder content-type to use if the user doesn't request one