A place to put common partial templates and RJS files?


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,


I stick them in a "shared" folder, then call out to them like this:

  render :partial => "shared/sort_div_tag"


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.

You're definitively faster than me, Tyler :slight_smile: