Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>The last comment from @GJK was pointing already in the right direction, but let me propose a somewhat elaborate answer to your question.</p> <p>One way you could do it is to hook into the <code>serialize</code> function of your <code>SuggestionRoute</code> and provide the missing dynamic segment your final url should have, conceptually this would be like this:</p> <p>Add the extra dynamic segment to your route definition, in your case <code>:name</code></p> <pre><code>App.Router.map(function() { this.resource('current-suggestions'); this.resource('suggestion', { path: '/current-suggestions/:name/:suggestion_id' }); }); </code></pre> <p>And then provide the data for the dynamic segment like this:</p> <pre><code>App.SuggestionRoute = Ember.Route.extend({ ... serialize: function(model) { var id = model.get('id'); var name = model.get('name'); return { name: name, suggestion_id: id } } }); </code></pre> <p><strong>Note:</strong> this solution assumes you provide the <code>name</code> property from your parent model for the <code>Suggestion</code> model, to achieve this you could rethink your model relationship's.</p> <p>And to inspire you on how you could refactor your app to achieve your goal (having url's like <code>/current-suggestions/Start/1</code> etc.) have a look here:</p> <p><strong><a href="http://jsbin.com/ebigit/4/edit" rel="nofollow">Demo</a></strong></p> <p>I've tried to simulate your use case but with a different approach.</p> <p>I hope it helps.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload