Sharing folders between RoR projects

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

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

Greg Donald 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 and https://admin.mystore.com

You don't need 2 apps to do that.

Fred

@Winter Mute

As already pointed out you *can* accomplish this in one project. Check into the new namespacing options for routes.rb (www.yourdomain.com/admin/product and 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.

Greetings -

@Winter Mute

As already pointed out you *can* accomplish this in one project. Check into the new namespacing options for routes.rb (www.yourdomain.com/admin/product and 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.

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.

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

1. different UI (V) 2. different interactions (C) 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

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.