1

I'm using Ember.js with Ember-Data 1.0.0beta2. I have a couple of namespaced routes which gather different version of the Organization model. Unfortunately, when I go to one of these namespaced routes (such as /explore/organizations) with Ember, it queries the url /organizations instead of /explore/organizations.

On the server-side, my controller actions look like this:

class Explore::OrganizationsController < ApplicationController
  respond_to :json, :html

  def index
    respond_with Organization.approved
  end
end

class Contribute::OrganizationsController < ApplicationController
  respond_to :json, :html

  def index
    respond_with Organization.pending
  end
end

The Ember route looks like this:

Whistlr.ExploreOrganizationsRoute = Ember.Route.extend
  model: ->
    @get('store').findAll('organization')

I suppose this is happening because Ember-Data assumes I have a conventional RESTful server without namespacing. I would like to find a way to tell it to query different URLs depending on the route. Unfortunately, the only way I've found to change the URL is at the adapter level, which changes the URL for the whole app. Is there a way to change it at the route level, instead, so that /explore/organizations and /contribute/organizations successfully query their respective namespaced actions?

4

0 回答 0