Skip to content

Files

Latest commit

 

History

History
38 lines (25 loc) · 811 Bytes

Rails-RenderPlainText.md

File metadata and controls

38 lines (25 loc) · 811 Bytes

Pattern: Use of render text:

Issue: -

Description

This cop identifies places where render text: can be replaced with render plain:.

Examples

# bad - explicit MIME type to `text/plain`
render text: 'Ruby!', content_type: 'text/plain'

# good - short and precise
render plain: 'Ruby!'

# good - explicit MIME type not to `text/plain`
render text: 'Ruby!', content_type: 'text/html'

ContentTypeCompatibility: true (default)

# good - sets MIME type to `text/html`
render text: 'Ruby!'

ContentTypeCompatibility: false

# bad - sets MIME type to `text/html`
render text: 'Ruby!'

Further Reading