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 what formats the Action accepts.
-
accepted_formats(formats, default)
Set what formats the Action accepts.
Instance Method Detail
Macro Detail
macro accepted_formats(formats)
#
Set what formats the Action accepts.
Same as accepted_formats
but this one only accepts one format and no
default. If you pass less 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 accepts formats are request, Lucky will raise
a Lucky::NotAcceptableError
error.
# Defaults 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]
# Give Lucky the default if ore than one format is accepted
accepted_formats [:html, :json], default: :html
macro accepted_formats(formats, default)
#
Set what formats the Action accepts.
If something other than the accepts formats are request, Lucky will raise
a Lucky::NotAcceptableError
error.
accepted_formats [:html, :json], default: :json