I m using following code to read a file content.
@file_content = String.new
IO.foreach "/path/to/file"
do |line|
# Do something with line.
@file_content << line
end
But If i m rendering @file_content in view, its not displaying new line chracter. Can anybody tell me how to capture new line chracter as well.
I have used this also.
@file_content = File.read("Path/to/file")
But its also not working.
HTML “newlines” are different from your regular newlines. Try inserting
<br/>after each line of text