views:

43

answers:

2

I have a couple of pre-existing applications which I need to run in "one" app. One is the application I want to use for authentication etc, whilst the other is another app that contains all of the business logic.

Both apps have pre-existing authentication, and both have fairly complex user models.

Is it possible to easily combine these so that if I log into one application and create a user, that same data is available in the other - or something similar?

What is the easiest way of doing this? Can a rails model extend a REST webservice?

A: 

You can use the new(ish) Engine feature to embed one app inside another. Your engine lives inside vendor/plugins, can have all of it's own routes and config setup just like a normal rails application but actually share the database. Makes combining applications really easy. We use it with git submodules to make management of complex applications seamless.

Toby Hede
One catch is that you will have to copy the public/ files though. You would not have that problem if you use the Engine's plugin.
andHapp
Good example would be the clearance gem - http://github.com/thoughtbot/clearance
andHapp
A: 

I'd use warden (or devise, which is built on it) for the authentication. Warden is rack-based, and can therefore be used in both apps aka single-sign-on.

Tass