Rails Mobile API -


i have existing rails project uses omniauth-facebook gem connect gem. facebook users can interact , use website. developing mobile application, , want build api current rails project.

which gem should use build api? should use 2 different rails projects, 1 website , 1 api?

thank you.

rails api ready, here quick example

lets imagine want show products of app in mobile app

lets go products controller:

controller:

  def index     @products = product.all             respond_to |format|       format.js       format.html       format.json { render json: @products }     end   end 

as can see can render json within controller, in mobile app can request on json extension this:

$.post('www.example.com/products.json', function(data) {   alert(data); }); 

now adapt mobile app read json, , thats basicly how works


Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -