How to create an alias for a route?


#1

I’ve got index route (path /) and I’d like to use the same controller, view and template for a different path (/room/:room_id). If there’s :room_id param present, route’s setupController method would work slightly differently.

What’s the easiest way to do it? I tried adding RoomRoute, RoomController and RoomView that all inherit from their index equivalents. It kind of works, but hopefully there’s a shorter way.

Anyway, there’s one problem with this solution. I’m defining IndexController#init method and it looks like it’s called twice - once with this as an instance of RoomController and the second time with this as an instance of IndexController. Any idea why it happens?

I’m using Ember 1.4.0.