문제

Is there any class in Rails Api that lists all Content-Type for ActionController ?

Like HTML, JSON, XML, JS, etc.

도움이 되었습니까?

해결책

Mime::EXTENSION_LOOKUP has all the available mime types.

Content type html would then be retrieved using Mime::EXTENSION_LOOKUP['html']:

[32] pry(main)> Mime::EXTENSION_LOOKUP["html"].to_s
=> "text/html"
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top