I am using ember backed by rails and postgresql. I am trying to access one model's data within a different model.
My models are like this:
App.Name = DS.Model.extend
calc_name: DS.attr 'string'
calc_num: DS.attr 'number'
atom_list: DS.attr 'string'
orbital_list: DS.attr 'string'
cluster_list: DS.attr 'string'
bound: DS.attr 'boolean'
states: DS.hasMany 'state', embedded: 'always'
App.State = DS.Model.extend
calc_num: DS.attr 'number'
energy_list: DS.attr 'string'
dos_list: DS.attr 'string'
atom_subset: DS.attr 'string'
orbital_subset: DS.attr 'number'
fermi_level: DS.attr 'number'
core_level: DS.attr 'number'
elec_occ_list: DS.attr 'string'
elec_energy_list: DS.attr 'string'
name: DS.belongsTo 'name', embedded: 'always'
The variable that connects the two tables are the calc_num. So each name will have multiple states that go along with it. How can I configure it so that I can display all of the states that point to a particular name on the name template? I am using the RESTAdapter. Thank you so much and sorry for the probably easy question, I have just seen conflicting ways to approach it.
Route:
App.StateRoute = Ember.Route.extend
model: (params) -> @store.find 'state', params.id
Abbreviated name template
article#name
h1
model.calc_name
link-to 'edit' 'name.edit' model classNames='edit'