Read contents of a local file into a variable in Rails
Posted
by Steven Xu
on Stack Overflow
See other posts from Stack Overflow
or by Steven Xu
Published on 2010-06-16T16:35:35Z
Indexed on
2010/06/16
16:42 UTC
Read the original article
Hit count: 217
ruby-on-rails
|ruby
All I want to do is get all the content from a local file and store it in a variable. How?
File.read(@icon.full_filename).each {|l| r += l}
only gives me a part of it. In PHP, I just used file_get_contents
.
Thanks!
© Stack Overflow or respective owner