Hi People, I''m pretty new to rails so please bear with me on this. I''m wanting to pull a text file into my rhtml page to use as the header part of my site. I know I can use layouts but it isn''t pratical for my problem as there could be hundreds of user made headers. So there are two ways I can see this happening. One is to store the location of the file in the database and use that with some sort of ruby html include tag in the html. The second is to some how pull the header text from the file into the model and then output it to the page. So my question is which of these is the "rails" ;) way to do this and how would each of these ideas work in code as I dont have a clue. hope I''ve made sense cheers Tony -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---
On 1/15/08, Mathew Mcloughlin <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> I''m wanting to pull a text file into my rhtml page to use as the header > part of my site. I know I can use layouts but it isn''t pratical for my > problem as there could be hundreds of user made headers.Do you know about render? <%= render :partial => ''some_dir/some_header'' %> http://api.rubyonrails.com/classes/ActionController/Base.html#M000452 -- Greg Donald http://destiney.com/ --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---
Ahh I didn''t you could use a partial like that doh! So is that the best way...there is no way to pull the directory contents into a property in the model? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---
On 1/15/08, Mathew Mcloughlin <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > Ahh I didn''t you could use a partial like that doh! > > So is that the best way...Compared to what other way?> there is no way to pull the directory contents > into a property in the model?Sure. I would use Dir.glob. http://www.ruby-doc.org/core/classes/Dir.html#M002347 -- Greg Donald http://destiney.com/ --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---