# Sharing folders between RoR projects

**URL:** <https://www.ruby-forum.com/t/sharing-folders-between-ror-projects/130509>\
**Category:** Rails\
**Created:** [February 28, 2008, 9:35pm UTC](https://www.ruby-forum.com/t/sharing-folders-between-ror-projects/130509 "2008-02-28T21:35:44Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![wintermute123](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/b19c9b/32.png) [@wintermute123](https://www.ruby-forum.com/u/wintermute123)\
**Post date:** [February 28, 2008, 9:35pm UTC](https://www.ruby-forum.com/t/sharing-folders-between-ror-projects/130509/1 "2008-02-28T21:35:44Z")

</div>

Greetings!

I am working on a small RoR project and decided to split the front-end  
and the admin portion into two separate RoR projects. The project is a  
typical e-commerce website and as such has a folder to keep the images  
and thumbnail of the products. I am currently keeping this folder under  
public/product\_images. This works fine with the front-end part, but is  
not accessible by admin project. I have two questions:

1. Is there a easy way to share a folder between two or more RoR  
projects
2. How this affects deployment

Your help will be greatly appreciated.

Thanks

---

<div class="post-metadata">

**Author:** ![wintermute123](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/b19c9b/32.png) [@wintermute123](https://www.ruby-forum.com/u/wintermute123)\
**Post date:** [February 28, 2008, 10:05pm UTC](https://www.ruby-forum.com/t/sharing-folders-between-ror-projects/130509/2 "2008-02-28T22:05:27Z")

</div>

On 2/28/08, Winter M. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I am working on a small RoR project and decided to split the front-end  
> and the admin portion into two separate RoR projects.

Why, you enjoy pain or something? That’s breaking DRY to the second  
power.

–  
Greg D.  
[http://destiney.com/](http://destiney.com/)

---

<div class="post-metadata">

**Author:** ![wintermute123](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/b19c9b/32.png) [@wintermute123](https://www.ruby-forum.com/u/wintermute123)\
**Post date:** [February 28, 2008, 10:13pm UTC](https://www.ruby-forum.com/t/sharing-folders-between-ror-projects/130509/3 "2008-02-28T22:13:47Z")

</div>

Greg D. wrote:

> Why, you enjoy pain or something? That’s breaking DRY to the second  
> power.

I have my reasons, the major one being I want to have 2 domains or a  
domain/subdomain, one regular and one SSL protected:

[http://www.mystore.com](http://www.mystore.com) and [https://admin.mystore.com](https://admin.mystore.com)

---

<div class="post-metadata">

**Author:** ![wintermute123](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/b19c9b/32.png) [@wintermute123](https://www.ruby-forum.com/u/wintermute123)\
**Post date:** [February 29, 2008, 5:51pm UTC](https://www.ruby-forum.com/t/sharing-folders-between-ror-projects/130509/4 "2008-02-29T17:51:21Z")

</div>

@Winter M.

As already pointed out you _can_ accomplish this in one project.  
Check into the new namespacing options for routes.rb  
([yourdomain.com is available for purchase - Sedo.com](http://www.yourdomain.com/admin/product) and [www.yourdomain.com/product](http://www.yourdomain.com/product)) as  
one alternative. Another would be to use Rails’ ability to deliver  
the subdomain names to your controller and take the appropriate  
action.

If you still must use two projects, you’d probably make the admin  
app’s public/product\_images a symlink to the one for the main app.

On Feb 28, 3:35 pm, Winter M. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![wintermute123](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/b19c9b/32.png) [@wintermute123](https://www.ruby-forum.com/u/wintermute123)\
**Post date:** [February 29, 2008, 11:21am UTC](https://www.ruby-forum.com/t/sharing-folders-between-ror-projects/130509/5 "2008-02-29T11:21:33Z")

</div>

On 28 Feb 2008, at 21:13, Winter M. wrote:

> Greg D. wrote:
> 
> > Why, you enjoy pain or something? That’s breaking DRY to the second  
> > power.
> 
> I have my reasons, the major one being I want to have 2 domains or a  
> domain/subdomain, one regular and one SSL protected:
> 
> [http://www.mystore.com](http://www.mystore.com) and [https://admin.mystore.com](https://admin.mystore.com)

You don’t need 2 apps to do that.

Fred

---

<div class="post-metadata">

**Author:** ![wintermute123](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/b19c9b/32.png) [@wintermute123](https://www.ruby-forum.com/u/wintermute123)\
**Post date:** [February 29, 2008, 5:58pm UTC](https://www.ruby-forum.com/t/sharing-folders-between-ror-projects/130509/6 "2008-02-29T17:58:25Z")

</div>

Greetings -

On 29-Feb-08, at 11:50 AM, AndyV wrote:

> If you still must use two projects, you’d probably make the admin
> 
> > typical e-commerce website and as such has a folder to keep the
> > 
> > Your help will be greatly appreciated.

I too am in favor of separate apps for the following reasons:

1. different UI (V)
2. different interactions ©
3. same business logic (M)

so how to do #3?

create a plugin, and put your models into it. Then include it in both  
your app and the admin project.

The added benefits are 2 fold - a reduction in the possibility of bugs  
(that can have grave consequences if your reg users gain some admin  
access), plus clearer separation for load and performance tuning. The  
database (unless you mirror) will be still be a common resource, but  
your mongrel/nginx/ etc can be tuned for end users. Additionally your  
deploys can be more liberal(frequent) with your admin users.

Jodi

---

<div class="post-metadata">

**Author:** ![wintermute123](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/b19c9b/32.png) [@wintermute123](https://www.ruby-forum.com/u/wintermute123)\
**Post date:** [February 29, 2008, 8:49pm UTC](https://www.ruby-forum.com/t/sharing-folders-between-ror-projects/130509/7 "2008-02-29T20:49:38Z")

</div>

On Fri, Feb 29, 2008 at 8:57 AM, Jodi S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > As already pointed out you _can_ accomplish this in one project.  
> > wrote:
> > 
> > > public/product\_images. This works fine with the front-end part, but  
> > > I too am in favor of separate apps for the following reasons:  
> > > The added benefits are 2 fold - a reduction in the possibility of bugs  
> > > (that can have grave consequences if your reg users gain some admin  
> > > access), plus clearer separation for load and performance tuning. The  
> > > database (unless you mirror) will be still be a common resource, but  
> > > your mongrel/nginx/ etc can be tuned for end users. Additionally your  
> > > deploys can be more liberal(frequent) with your admin users.
> 
> Jodi

We use symlinks for app/models, app/layouts, with some shared helper,  
lib, javascript, and stylesheet paths too. It works fine. We just  
have to remember to do all db migrations on the admin app.

It’s a mixed bag of pros/cons, really.

–  
Rick O.  
[http://lighthouseapp.com](http://lighthouseapp.com)  
[http://weblog.techno-weenie.net](http://weblog.techno-weenie.net)  
[http://mephistoblog.com](http://mephistoblog.com)
