# Organizing rhtml and rjs files?

**URL:** <https://www.ruby-forum.com/t/organizing-rhtml-and-rjs-files/114522>\
**Category:** Rails\
**Created:** [September 13, 2007, 9:23pm UTC](https://www.ruby-forum.com/t/organizing-rhtml-and-rjs-files/114522 "2007-09-13T21:23:57Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![dnstevenson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/8dc957/32.png) [@dnstevenson](https://www.ruby-forum.com/u/dnstevenson)\
**Post date:** [September 13, 2007, 9:23pm UTC](https://www.ruby-forum.com/t/organizing-rhtml-and-rjs-files/114522/1 "2007-09-13T21:23:57Z")

</div>

Is it possible to keep rjs and rhtml files in different subdirectories  
of a view, for purely organizational reasons? On a very AJAX heavy  
view, there are a LOT of partials, and it just gets a bit messy.

---

<div class="post-metadata">

**Author:** ![dnstevenson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/8dc957/32.png) [@dnstevenson](https://www.ruby-forum.com/u/dnstevenson)\
**Post date:** [September 14, 2007, 4:25pm UTC](https://www.ruby-forum.com/t/organizing-rhtml-and-rjs-files/114522/2 "2007-09-14T16:25:36Z")

</div>

> (I’d love to see the page that has THAT many partials being called.)

Well, assume a user has a list of things. There is a partial for the  
entire list, so that you can delete a couple at a time and re-render the  
entire list. There is also a partial for each row. That pattern repeats  
for several other lists of things associated with the user.

Then there are some selection/editing containers that are loaded  
asynchronously when an item is selected, and their contents are in  
partials. And, of course, those partials might in turn have their own  
listings of things, which can be asynchronously manipulated.

(This app is more of a local intranet thing that looks more like a  
desktop app than a web app. To be honest, it evolved into AJAX overkill,  
and I’m regretting it.)

---

<div class="post-metadata">

**Author:** ![dnstevenson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/8dc957/32.png) [@dnstevenson](https://www.ruby-forum.com/u/dnstevenson)\
**Post date:** [September 13, 2007, 9:31pm UTC](https://www.ruby-forum.com/t/organizing-rhtml-and-rjs-files/114522/3 "2007-09-13T21:31:38Z")

</div>

Dave S. wrote:

> Is it possible to keep rjs and rhtml files in different subdirectories  
> of a view, for purely organizational reasons? On a very AJAX heavy  
> view, there are a LOT of partials, and it just gets a bit messy.

If you call the ALL your views directly using “render :action / :partial  
=\> :blah” I don’t see why not.

But otherwise I will have to assume (since I really don’t know for sure)  
you’re breaking the conventions issued by Rails… and Rails is all about  
“Coding by Convention”.

(I’d love to see the page that has THAT many partials being called.)

Wish I could be more helpful.

---

<div class="post-metadata">

**Author:** ![dnstevenson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/8dc957/32.png) [@dnstevenson](https://www.ruby-forum.com/u/dnstevenson)\
**Post date:** [September 14, 2007, 4:27pm UTC](https://www.ruby-forum.com/t/organizing-rhtml-and-rjs-files/114522/4 "2007-09-14T16:27:06Z")

</div>

Can anyone recommend a good resource for learning good MVC design  
techniques for working with AJAX? I have some questions about what is  
the “correct” way to delegate responsibility between controllers, etc.,  
and how much to assume about the callers and associated views from  
within ajaxy controllers.
