简体   繁体   中英

How can I create separate Rails applications that shares same models?

I've got web application and api.

  • Web application is traditional application that renders views.
  • Api is stateless REST services.

Web application and api will run on separate servers.

How can I share model classes between them?

You could write a gem with the models you want to share. Then use the gem in both applications.

Another way would be to use the same application on both servers where the application and the api are both implemented. Then one could disable the app/api depend on the domain.

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