我正在 S3 上存储客户特定的部分。当我呈现 S3 对象的值时,它呈现为文本。如何渲染它以使其出现在我的主布局中?
最佳答案
看起来我只需要:
render :text => myTextFromS3, :layout => true
它有效!
更新:自 2013 年以来,轨道发生了变化
有3种不同的方式:
render html: '<strong>HTML String</strong>' # render with `text/html` MIME type
render plain: 'plain text' # render with `text/plain` MIME type
render body: 'raw body' # render raw content, does not set content type, inherits
# default content type, which currently is `text/html`
来源 https://github.com/rails/rails/issues/12374
关于ruby-on-rails-3 - 我可以在 Rails 3 中将文本字符串呈现为部分吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6023129/