0

How to create an API using ruby on rails?

I need code which help me to understand the creation of API which provides data in json form and consume that json in my Android app.

25th Dec 2017, 1:41 PM
Dilip Kashyap
Dilip Kashyap - avatar
1 Answer
0
Rails allows you to export your output directly to JSON. http://guides.rubyonrails.org/layouts_and_rendering.html#using-render 2.2.8 Rendering JSON JSON is a JavaScript data format used by many Ajax libraries. Rails has built-in support for converting objects to JSON and rendering that JSON back to the browser: render json: @product You don't need to call to_json on the object that you want to render. If you use the :json option, render will automatically call to_json for you
30th Dec 2017, 5:54 AM
Frédéric Charette
Frédéric Charette - avatar