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 MySQ开发者_StackOverflow中文版L that I need to be concerned about for above access scenerio? Thanks
Running: Rails 2.3.5, MySQL 5.0, Nginx, Passenger, RubyEE
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.
I answered similar question here. You can do it and sometimes it is reasonable.
精彩评论