Most Rails database-deployment discussions assume you will find two areas of a database: the schema, that is handled in code via migrations, and also the data, that is all user-produced rather than must range from test to production. How about the items that is based on between?

For instance, we have many mostly-static tables which contain complex surveys our customers may take: questions, options, branching. You want to have the ability to edit individuals surveys via our web application, but you want to have the ability to test changes around the staging server before we push these to production.

What's a great way to handle this in Rails, which wants all of the models to appear in one database, and definitely wouldn't such as the same model (with various contents) to appear in two databases? What are the good discussions online, or any gems which have abstracted out this kind of functionality?

I have labored having a large, complex Content management systems system which had its very own multi-atmosphere version control and deployment, which means you could deploy your switch to the exam system (without riskily connecting the exam and production databases), test drive it completely, after which perform a one-click deploy to production. I suppose I am searching for something of that nature on the more compact scale.

I'd use ActiveResource to drag the preferred records in the staging atmosphere to production. Alternatively, you can produce a title-spread group of ActiveRecord models for connecting towards the staging database directly. In either case, the implementation is roughly exactly the same, but ActiveResource enables more versatility with altering deployment particulars and also the ActiveRecord method requires less setup code.

The particular implementation code ought to be quite simple - pull a listing of not-imported records from staging (you'll most likely wish to map the development records for their source staging records to simply prevent duplication) and copy the information.

Unsure about Rails however i am one python script known as Migraine, its helpful to syncing development, staging, and live (production) sites' databases for Drupal Content management systems. For more information refer this :

  1. Presentation
  2. Get Migraine script here