# Dry application architecture

**URL:** <https://www.ruby-forum.com/t/dry-application-architecture/147779>\
**Category:** Rails\
**Created:** [September 5, 2008, 11:44am UTC](https://www.ruby-forum.com/t/dry-application-architecture/147779 "2008-09-05T11:44:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![gabriel83](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/5fc32e/32.png) [@gabriel83](https://www.ruby-forum.com/u/gabriel83)\
**Post date:** [September 5, 2008, 11:44am UTC](https://www.ruby-forum.com/t/dry-application-architecture/147779/1 "2008-09-05T11:44:56Z")

</div>

Hi everyone.  
In my company we developed a rails cms and now we are trying to figure  
out how to use it in the smartest way.

We would like to use our modules, wich are mvc for common site elements  
like ‘pages’, ‘posts’, ‘news’, ‘feed’ etc, as svn externals in every  
site project. In this way if we find a bug in the cms core we can easily  
update every site we made.

In the same time we would like to make possible to extend our core  
modules for customizing them if needed.

We thought this directory structure would be nice:

site\_project/  
/app  
/public  
… other rails dirs …  
/modules # \<-- here we want to put svn:external to cms modules  
/app  
/models  
page.rb  
post.rb  
/views

the extension of core modules will be put on site\_project/app as a  
normal rails application. If we don’t put an extension we want to load  
the related module.

E.g. in the directory i put before if i define  
site\_project/app/models/page this file will be loaded but if my  
application will need post.rb the modules file will be loaded.

I know i didn’t explain very clear I hope someone would understant  
enough to help me, even because i bet it’s a common problem for studios  
that use rails for web developing.

best regards.

---

<div class="post-metadata">

**Author:** ![gabriel83](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/5fc32e/32.png) [@gabriel83](https://www.ruby-forum.com/u/gabriel83)\
**Post date:** [September 11, 2008, 3:10am UTC](https://www.ruby-forum.com/t/dry-application-architecture/147779/2 "2008-09-11T03:10:32Z")

</div>

Gabriel, the way I do this personally is to put my  
models/views/controllers/helpers in a plugin, and then have the plugin  
loaded via the engines plugin.

If you’re using all subversion repositories for everything, you can  
use svn:externals to point to your plugin and you should be good to  
go. If not, I recently released a rubygem called ‘ext’ that lets me  
do svn:externals-like stuff with git, so I use that to manage  
subprojects. For example, the engines repository is managed via git  
so if you use svn:externals you would have to check the whole engines  
repository into your main projects’ repositories. I personally find  
that kind of annoying to do, especially if you make modifications to  
the engines repository (which I had to) since you would then have to  
go to all your projects and fix the engines plugins there as well (or  
even just to do a git pull to get the latest engines changes would  
require making a commit to every main project that uses engines.)  
Those type of annoyances are what inspired me to make ext.

Either way, take a look at the engines plugin and see if you can use  
it to solve this problem, as I had success with the engines plugin.

Miles

On Fri, Sep 5, 2008 at 2:44 AM, Gabriel CA2000
