I am trying to figure out how to use slug (an attribute of my model) in my ember routes to get cleaner urls.
I would like my routes to look like this:
http://www.server.com/
Instead:
http://www.server.com/
As you can see, I would like to replace the newsitem identifier with the actual slug attribute. Here's what my Newsitem model looks like:
App.Newsitem = DS.Model.extend({ slug: DS.attr('string'), title: DS.attr('string'), summary: DS.attr('string'), });
The slug property gets a pure text attribute in this format: title-in-slug-format
This is the map of my router at the moment:
App.Router.map(function(){ this.resource('newsitems', function(){ this.resource('newsitem', {path:':newsitem_id'}); }); });
I tried replacing newsitem_id with newsitem_slug , but this does not work. Any other suggestions?
source share