Static data and radio buttons

I have a survey form app with multiple questions, and each question has different set of choices. So I created the following models:

export default DS.Model.extend({
   text: DS.attr(),
   choices: DS.attr()

export default DS.Model.extend({
   name: DS.attr(),
   choices: DS.attr()

I have added the question data using mirage-fixtures as following:

id: '1',
text: '...',
choices: ['A', 'B', 'C'] 
}, { ... }

Since I can’t figure how to call question records and create answer record in the same route, I have loaded the question data in the application route, which is totally unnecessary.

Another problem was handling the chosen values and save it to answer.choices attribute. So I thought using a component for questions would help store choices (like this approach in Ember guide) and push chosen values to model data. But the only way I figure was to create a component for each question, since they have a different set of choices (a question may have 2, 3 or 5 choices with different text) this would be insane!

I have tried ember-radio-button also there is a a custom component found here, but neither of them was helping or I don’t quite understand them.

So my questions are:

  • How shall I get static data such as questions and its choices into a single component and call it in its template?
  • And how can I make chosen values to bind to answer record?


I realize this is a delayed post, but have you solved the questions you’ve posted here?