Skip to content

Instantly share code, notes, and snippets.

@PatrickLef
Created September 9, 2010 13:18
Show Gist options
  • Save PatrickLef/571842 to your computer and use it in GitHub Desktop.
Save PatrickLef/571842 to your computer and use it in GitHub Desktop.
def provides(*types)
types = [types] unless types.kind_of? Array
types.map!{|t| mime_type(t)}
condition {
matching_types = (request.accept & types)
unless matching_types.empty?
response.headers['Content-Type'] = matching_types.first
true
else
false
end
}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment