1

I am currently have a running site. However, I need to do some task to sync some data to my friend's site.

So that, I need another app for fetching data from my running app's DB and submit data to another site using a gem call mechanize.

My problem will be:

  1. Do I need a whole Rails app to do the job? If not, what would be the best practice in my case?
  2. Is there any easy way for accessing my running app's DB? For now, the only thing I know is AR.

Thanks

MK Fu
  • 11
  • 1
  • 1
    you need to follow RESTful way to send request and get response you can also use gem https://github.com/rest-client/rest-client – Rajarshi Das Apr 09 '14 at 07:38
  • 1
    Use a ruby application instead of a rails app. You would need to use ActiveRecord(or sth else depending on the db). And use another Gem to make requests and suggested above. – Alok Swain Apr 09 '14 at 08:03

1 Answers1

1

API

What you're looking for is an API -- a way to connect to a source of data & use that data in some other application:

In computer programming, an application programming interface (API) specifies how some software components should interact with each other

APIs are actually very simple -- you have a series of endpoints which an application can connect to, pulling data, typically as JSON objects. As noted by Rajarshi Das, these endpoints will likely be based on the RESTful resource structure


Rails

Rails, by design, is very good at providing API's:

enter image description here

This Railscast shows how to use the rails-api gem to create a RESTful API that your other app can connect to

Community
  • 1
  • 1
Richard Peck
  • 76,116
  • 9
  • 93
  • 147
  • 1
    Thanks, I will take a look. A simple ruby app seems to be a better solution. Thank you for your help anyway. – MK Fu Apr 09 '14 at 10:43