1 Dec 2008 01:06
Re: Formatting issue
On Nov 30, 11:36 pm, John Victor <rails-mailing-l...@...> wrote: > I have a text file that has data in it which is perfectly formatted the > way I want it. > I have the following code in my controller to open the file and read > each line into an array which I then call from my view. The problem is, > I completely loose the formatting the way I'm doing it: <%= ... %> basically just calls to_s on whatever the expression in there evaluates to, and to_s on an Array is just the concatenation of to_s called on everything in it. If you just want to display data from the file, why not use <at> my_data = File.read(...) ? Fred > > - from my controller: > <code> > def index > <at> ssh = Array.new > a = File.open("/usr/bin/my_data.dat") > a.each do |line| > <at> my_data.push(line) > end > end > </code> > > -from my view: > <code>(Continue reading)
RSS Feed