Rails 3:如何在线呈现文本文件? [英] Rails 3: how to render text file in-line?

查看:35
本文介绍了Rails 3:如何在线呈现文本文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

全部.

A Rails n00b here ...

A Rails n00b here...

我正在编写一个报告交易状态的应用程序. 呈现的HTML中的某些内容来自实例变量 在控制器中初始化,而其他内容来自文本文件 我想使用<pre>标签在HTML中呈现的内容(例如日志文件).

I'm writing an application that reports the status of a transaction. Some of the content in the rendered HTML comes from instance variables initialized in the controller, while other content comes from text files (e.g., log files) that I want to render in the HTML using <pre> tags.

执行此操作的路线"是什么?

What is the "Rails Way" to do this?

谢谢您的时间...

推荐答案

<pre>
    <%= render :file => '/tmp/test.log' %>
</pre>

这篇关于Rails 3:如何在线呈现文本文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆