Hi all, i'm starting to work with Erlang and CB, and i'm building a RESTful 
api, and i have a question about how to build the json to access data from 
one model to another

My model and my controller looks like this:


%% review model
-module(review, 
    [
        Id,
        UsersId,
        Score::integer(), 
        Speed::integer(), 
        Comment::string(),
        Date::datetime()
    ]
).
-compile(export_all).
-belongs_to(users).



%% users model
-module(users, 
    [
        Id, 
        FirstName::string(), 
        LastName::string(), 
        Email::string()
    ]
).
-compile(export_all).
-has({reviews, many}).



%% my review controller:

api('GET', [Id]) ->
    Review = boss_db:find(Id),
    case Review of
        Review ->
            {json, [{review, Review}]};
        [] ->
            not_found
    end;


%% and my current json is as follows


       [{
          "id":"review-1",
          "users_id":"users-1",
          "score":1,
          "speed":1,
          "comment":"foo",
          "date":"February 07, 2014 21:52:53",
       }]



and my question is how to access the data from the "users-1"

Thank you very much, and sorry for the length of the message

-- 
You received this message because you are subscribed to the Google Groups 
"ChicagoBoss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
Visit this group at http://groups.google.com/group/chicagoboss.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/chicagoboss/1d75334c-3879-4e84-9d9e-9a5eb3a360c1%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to