module Lucky::VerifyAcceptsFormat
Overview
Configure what types of formats your action responds to
Direct including types
Defined in:
lucky/verify_accepts_format.crInstance Method Summary
Macro Summary
-
accepted_formats(formats)
Set the single format that the Action accepts.
-
accepted_formats(formats, default)
Set what formats the Action accepts.
Instance Method Detail
Macro Detail
macro accepted_formats(formats)
#
Set the single format that the Action accepts.
Same as accepted_formats
but this one only accepts one format and no
default. If you pass an empty array or more than one format, you must
use the other accepted_formats
so you can tell Lucky what the default
format should be.
If something other than the accepted formats are requested, Lucky will raise
a Lucky::NotAcceptableError
error.
# Default is set to :html since there is just one format
accepted_formats [:html]
# Raises at compile time because Lucky needs to know which format is the default
accepted_formats [:html, :json]
# If more than one format is accepted, you must provide the default explicitly
accepted_formats [:html, :json], default: :html
macro accepted_formats(formats, default)
#
Set what formats the Action accepts.
If something other than the accepted formats are requested, Lucky will raise
a Lucky::NotAcceptableError
error.
accepted_formats [:html, :json], default: :json