views:

50

answers:

2

Due to hosting constraints I am porting an ASP.NET MVC to Ruby On Rails. In my ASP.NET application I had 2 web applications. One for the Admin section, and one for the public section.

Both referenced a class library that held all my Business Logic and Data.

Now I want to accomplish the same thing in Ruby On Rails. How do I use my model in two applications?

+1  A: 

First shot: put the business logic and associated models in a plugin.

Second shot: use SVN externals or Git submodules to replicate the exact code in your app, for example under APP_ROOT/lib/ and then require it in your environment.

And last... why not putting the admin and public section in the same app?

pantulis
A: 

I would create a plugin. Call it IceheatSharedLogic or something. Add the model and supporting code to the plugin and commit it to its own source control location. Add that plugin via svn:externals or equivalent to both apps.

But given your use case, is it really necessary to have 2 apps? It seems that would make things complicated if you ever needed any interaction between them (such as putting an edit link on a page, if you are logged in as an admin).

Squeegy