views:

55

answers:

2

I intend to have multiple Rails apps each for site.com, api.site.com, admin.site.com. All apps will access the same tables from one single MySQL database. Apps and database runs in the same server.

Is there any settings in Rails, ActiveRecord or MySQL that I need to be concerned about for above access scenerio? Thanks

Running: Rails 2.3.5, MySQL 5.0, Nginx, Passenger, RubyEE

+3  A: 

This configuration tends to be quite difficult to maintain. In every app, you would need to keep schema.rb and models in sync in order to use the same database. It means lot of duplication.

This isn't probably a good idea. Instead, you might want to design the application to meet one of the following scenario:

  • one Rails application which handles site.com, api.site.com and admin.site.com (why do you need separate app?)
  • multiple Rails applications, but just one interact with the db. The others uses the main application API (quite complex)
  • different apps with different purposes (for instance, you might want to use Sinatra + Datamapper for api.site.com)

The first option is probably the best one in most cases.

Simone Carletti
I agree with the 1st one, you can have it all in one app.
Adnan
I will reconsider, first option probably. Thanks.
Gaius Parx
+1  A: 

I answered similar question here. You can do it and sometimes it is reasonable.

klew