I've been trying to render data in the same view and cant seem to get something right. I want to be able to render the rating for each location on the locations show outlet.
Here's what I have got.
I've tried different routes and different nesting for resources as well as rendering different things in the rails controllers. I can get back a hash of the correct ratings but dont know how to display it.
I'm assuming that something is wrong in my rails controllers or something I need to do in the Handlebars views. I've tried so many things so I didnt even post my rails stuff. If this Ember stuff is correct what is the correct way to render this with handlebars and the rails controller.
App.Router.reopen
location: 'history'
rootURL: '/'
App.Router.map ->
@resource 'users', ->
@route 'new',
@route 'edit',
path: '/:user_id/edit'
@route 'show',
path: '/:user_id'
@resource 'locations', ->
@route 'new',
@route 'show',
path: '/:location_id'
@resource 'ratings', ->
@route 'new',
@route 'show',
path: '/:ratings_id'
App.Rating = DS.Model.extend(
rating: DS.attr('string', defaultValue: "-0")
description: DS.attr('string', defaultValue: "No Description Provided")
location: DS.belongsTo("App.Location")
)
App.Location = DS.Model.extend(
name: DS.attr('string', defaultValue: "")
address: DS.attr('string', defaultValue: "")
city: DS.attr('string', defaultValue: "")
state:DS.attr('string', defaultValue: "")
ratings: DS.hasMany('App.Rating')
fullAddress: (->
"http://maps.google.com/?q=#{@get('address')},#{@get('city')},#{@get('state')}}"
).property('address')
)
App.Store = DS.Store.extend(
revision: 11
adapter: DS.RESTAdapter.create(mappings:
ratings: App.Rating
)
)