简体   繁体   中英

Transferring certain Rails objects from staging to production database on heroku

I have a web app where admins are able to create "Book" objects which are published and accessed via API in a mobile app. We want to allow the admins to create these books in a staging environment and then push them to the production database when they have been tested on the mobile app. From there, we want to allow them to make edits to these books on the staging app/db, and then we push them when ready for production. We do not want any edits being directly made on production.

What would be the best way to do this? My initial thought is using SQL import/export. But I'm wondering if there is a more elegant unobtrusive way.

I would say that you're going about this in the wrong way. Staging and production apps are a great way to manage and test different versions of your code, but using them to test and stage data, and then shuffling that data around, is not optimal.

Instead I would have a "draft" mode for books in the app that made them only visible to admins or testers. Once they're happy with a book, they can set is_draft to false and then the book is visible to everyone.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM