lundi 2 février 2015

How can I access my Rails backend API information in my Ember client side?

I'm a beginner at coding and I'm working on this tutorial right now and I'm having a bit of trouble. I would really appreciate some help!


Here's my problem: I'm using an external API in my Rails backend. I'm not using a model. But the tutorial is asking me to access a model in this section when I want to access my API information from my Rails class.


This is what they want me to do:



Library.BooksRoute = Ember.Route.extend({
model: function() {
return this.get('store').find('book');
}
});


How can I change that code to access my API? I'm using HTTP party.


Here's a bit of what my activities controller looks like:



class BooksController < ApplicationController
respond_to :json
include HTTParty
base_uri '' # took this out
def index
render json: self.class.get("") # took out my link with API key here
end
end


Thanks in advance!





Aucun commentaire:

Enregistrer un commentaire