Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails 3: how to render text file in-line?

All.

A Rails n00b here...

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?

Thank you for your time...

like image 770
jgpawletko Avatar asked Jun 06 '11 21:06

jgpawletko


2 Answers

<pre>
    <%= render :file => '/tmp/test.log' %>
</pre>
like image 107
cailinanne Avatar answered Sep 18 '22 15:09

cailinanne


Here you go: http://edgeguides.rubyonrails.org/layouts_and_rendering.html

like image 24
Roman Avatar answered Sep 19 '22 15:09

Roman