Quantcast
Channel: Ember.JS - Latest topics
Viewing all articles
Browse latest Browse all 4828

Ember Route cannot find model

$
0
0

@johnnyicon wrote:

Hi all,

I’m having an issue with loading a model into a route. This is a legacy app with some convoluted code, so I’ll try to add some context to the situation so it makes sense.

I’m trying to load an organisational-unit (UK spelling) into the dashboard route.

router.js

  this.route('producer', {path: '/orgs/:org_id'}, function() {
    this.route('dashboard');
  }

routes/producer/dashboard.js

  model(params) {
    return this.get('store').findRecord('organisational-unit', params.org_id);
  }

The model organisational-unit exists.

When I try to access the route orgs/1/dashboard as an example, I get the following error in the web console.

-private.js:12702 Uncaught Error: No model was found for 'org'
    at Class._modelFactoryFor (-private.js:12702)
    at Class.modelFor (-private.js:12686)
    at InternalModel.get (-private.js:4543)
    at InternalModel.get (-private.js:4548)
    at Class._fetchRecord (-private.js:11366)
    at _fetchRecord (-private.js:11452)
    at Class._flushPendingFetchForType (-private.js:11553)
    at Map.forEach (<anonymous>)
    at Class.flushAllPendingFetches (-private.js:11430)
    at invoke (backburner.js:341)

I thought that by specifying the modelName in findRecord would determine the model that would be used.

Am I wrong? What should I be doing instead?

Thanks in advance!

Posts: 3

Participants: 3

Read full topic


Viewing all articles
Browse latest Browse all 4828

Trending Articles