views:

60

answers:

1

I wrote a web application in ROR, but I want it supports web service, so that I can do the same things on non-web application platform. What should I do to add web service ability to my web application... ...or I need to reinvent my application, to write a separate web service independently?

+3  A: 

you want to use responds_to in your controllers. Here is a good explanation.

jshen
looks easy, can I return JSON instead of XML?
Tattat
yes, read this for more details. http://www.neeraj.name/blog/articles/612-rails-under-the-hood-how-respond_to-works
jshen