开发者

transfer the data between mutiple rails application

开发者 https://www.devze.com 2023-01-29 08:26 出处:网络
Now i have a task to do,the task is as the title said, now i should crate a rails application to get the data from the other four rails application. i should make the interface for the rails applicati

Now i have a task to do,the task is as the title said, now i should crate a rails application to get the data from the other four rails application. i should make the interface for the rails application ,so my new rails application can get the data from the others. how should i do? what is 开发者_StackOverflow社区the best way to solve the task? web-service or some other solution for this? Thank you and best regards!


  1. You can create a controller method inside all the other four rails apps so it can be called by this new rails app using XMLHttpRequest.
  2. Or you can have one common database to put in the data, and let the the other four rails apps polls to the database to check if there is new data available.


The answer is, "it depends." Info you'd need to know in order to nail it down is:

  • How often do you need to transfer the data?
  • Is the data text or binary?
  • How much data are we talking about?

But the fastest and easiest way to do this, which will be enough to get you started, is to use the built-in REST features of Rails:

  1. In the source Rails apps, set up your data using scaffolding (generate scaffold).
  2. In the receiving Rails app, connect to the sources by setting them up as active resources. See http://api.rubyonrails.org/classes/ActiveResource/Base.html
0

精彩评论

暂无评论...
验证码 换一张
取 消