My application utilizes the file_column plugin to allow the uploading of text files (and only text files) to the server. What I would like to be able to do is when the "show" view template is rendered for a particular record, instead of providing a link to the particular textfile for the record, have it display the actual contents of the file inline along with the rest of the fields. If the files were images it would be trivial to get them to display inline by wrapping the file_column-ized field in some HTML. However since the field contains only a pointer to the file''s location in the filesystem I''m not sure how to get the contents out of the text file and in the view. Right now I have the text file appearing as a link which, when clicked, opens a popup with the contents inside of it. An ok compromise, but I really would like to get it all on one page. Thanks in advance for any help! --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
On Fri, 2006-10-27 at 14:39 +0000, Dave Davidson wrote:> My application utilizes the file_column plugin > to allow the uploading of text files (and only > text files) to the server. What I would like to > be able to do is when the "show" view template is > rendered for a particular record, instead of providing > a link to the particular textfile for the record, have > it display the actual contents of the file inline > along with the rest of the fields. > > If the files were images it would be trivial to get > them to display inline by wrapping the file_column-ized > field in some HTML. However since the field contains > only a pointer to the file''s location in the filesystem > I''m not sure how to get the contents out of the text file > and in the view. > > Right now I have the text file appearing as a link which, > when clicked, opens a popup with the contents inside of it. > An ok compromise, but I really would like to get it all > on one page. > > Thanks in advance for any help!---- this is code that I use in one of my controllers that can do this... @ray_message = File.file?("/var/www/html/motd/ray.txt") ? arr IO.readlines("/var/www/html/motd/ray.txt") : "Nothing at this time" Craig --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
Craig White <craigwhite@...> writes:> this is code that I use in one of my controllers that can do this... > <at> ray_message = File.file?("/var/www/html/motd/ray.txt") ? arr > IO.readlines("/var/www/html/motd/ray.txt") : "Nothing at this time" >You sir, are a genius. Worked like a charm. Many thanks! --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---