On Jun 23, 12:49 am, DonVito
<muad...-F+cxT9S4P5Rg9hUCZPvPmw@public.gmane.org>
wrote:> Hello Everyone.
>
> There is a method withing controller which is supposed to
> 1. read a text file
> 2. puts its content into the output
>
puts does nothing useful in a view. Your method needs to return what
it wants displayed.
Fred
> Problem: Output shows up in console window while not showing in html
> output.
>
> Method itself:
> def print_file_contents
> file = "path/to/the/file"
> infile = File.open(file, ''r'')
> while line = infile.gets
> puts line
> end
>
> View template (print_file_contents.text.erb) :
> <%= hp.print_file_contents %>
>
> Note: the console output is correct. The only problem is it
doesn''t
> show in the browser.
>
> Thanks in advance.
> DonVito.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---