1

What is the best way to communicate between an iphone app and a rails web app? I need to be able to register as a user, edit my profile and upload, rate and comment images in the rails web app.

In my rails controllers I have a lot of stuff (logic), I don't need when communicating with an iphone. How can I separate the logic for the iphone and the web in my controller? Should I use separate controllers for web and iphone communication?

What's the best tool/framework on the iphone to exchange data and images with a rails app? I looked at ObjectiveResource, but I'm not sure if it will to the trick (including image uploads).

Arwed
  • 1,755
  • 3
  • 16
  • 26

2 Answers2

1

I think it works nicely to have an API directory with a set of controllers that define your API.

So you'd have, for example /app/controllers/api/items_controller.rb and a /app/controllers/api/base_api_controller.rb

Inherit from your BaseApiController instead of ApplicationController, and you can get your api token from there, etc.

In your routes:

namespace :api do
  resources :items
end
Manish Shrivastava
  • 30,617
  • 13
  • 97
  • 101
Jesse Wolgamott
  • 40,197
  • 4
  • 83
  • 109
1

Take a look at this presentation :) http://www.slideshare.net/sujee/iphone-clientserver-app-with-rails-backend-v3

Trinca
  • 1,606
  • 1
  • 15
  • 17