Greetings, I have a partial template file (acutally, it is an RJS file but the same principle is in question here) which I wish to "share" between multiple controllers. Does anyone know where in the directory tree I would put these files in order that I can access them from multiple controllers in the same app? I really would prefer not having to copy them all into all of the directories. I guess what I am looking for is a "mixin" type thing for views. I tried putting them in a directory called "application" under views, but that didn''t work. Thanks in advance, Peter --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Tyler MacDonald
2007-Mar-14 22:45 UTC
Re: A place to put common partial templates and RJS files?
P² <pavlovich-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I have a partial template file (acutally, it is an RJS file but the > same principle is in question here) which I wish to "share" between > multiple controllers. Does anyone know where in the directory tree I > would put these files in order that I can access them from multiple > controllers in the same app?I stick them in a "shared" folder, then call out to them like this: render :partial => "shared/sort_div_tag" Cheers, Tyler --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Pierre-Alexandre Meyer
2007-Mar-14 22:53 UTC
Re: A place to put common partial templates and RJS files?
On Wed, Mar 14, 2007 at 10:40:48PM -0000, P² wrote :> I guess what I am looking for is > a "mixin" type thing for views. I tried putting them in a directory > called "application" under views, but that didn''t work.I put my shared views rjs/templates in app/view/shared/ For instance: render :partial => ''shared/my_partial'' render :file => ''shared/my_file.rtex'' For other snippets, put them in lib/* and add a ''require your_file'' at the beginning of your controller, or, if you''re playing with modules, ''include my_module'' after the beginning of your ApplicationController. ++ -- ,========================. | Pierre-Alexandre Meyer | | email : pam-1sEOgp2Wo8Qdnm+yROfE0A@public.gmane.org | `========================'' --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Pierre-Alexandre Meyer
2007-Mar-14 23:06 UTC
Re: A place to put common partial templates and RJS files?
On Wed, Mar 14, 2007 at 03:45:18PM -0700, Tyler MacDonald wrote :> I stick them in a "shared" folder, then call out to them like this: > > render :partial => "shared/sort_div_tag"You''re definitively faster than me, Tyler :) -- ,========================. | Pierre-Alexandre Meyer | | email : pam-1sEOgp2Wo8Qdnm+yROfE0A@public.gmane.org | `========================'' --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---