question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Mirage fails when models are in sub-folders

See original GitHub issue

Using 0.2.0-beta.8 ember g mirage-model admin/log

ember.debug.js:32127Error: Assertion Failed: Subdirectories under admin are not supported at new Error (native) at Error.EmberError (http://localhost:4200/assets/vendor.js:26056:21) at assert (http://localhost:4200/assets/vendor.js:15815:13) at Object.assert (http://localhost:4200/assets/vendor.js:25820:34) at http://localhost:4200/assets/vendor.js:117769:25 at Array.forEach (native) at exports.default (http://localhost:4200/assets/vendor.js:117761:8) at startMirage (http://localhost:4200/assets/client.js:415:66) at Object.initialize (http://localhost:4200/assets/client.js:406:9) at http://localhost:4200/assets/vendor.js:14823:23

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:3
  • Comments:14

github_iconTop GitHub Comments

4reactions
abrthelcommented, Jun 10, 2016

To work around this issue for now I’ve implemented the typeKeyForModel hook in my mirage application serializer.

import { JSONAPISerializer } from 'ember-cli-mirage'
import Ember from 'ember'
const { dasherize, pluralize } = Ember.String

export default JSONAPISerializer.extend({
  typeKeyForModel(model) {
    let typeKey = model.typeKey || model.modelName
    return dasherize(pluralize(typeKey))
  }
})

Then on each model I just place a typeKey attribute where I need to adjust the output type. For instance I have a model that lives in the folder models/references/faction and ember can find it if I create a mirage model like so

import { Model } from 'ember-cli-mirage'

export default Model.extend({
  typeKey: 'references/faction'
})
1reaction
mrosenbergcommented, Jun 6, 2016

I’m writing some manual fixes now.

Mirage is awesome and the new ORM will be killer. Thanks for all your hard work on this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Mirage fails when models are in sub-folders #663 - GitHub
It looks like Mirage does a lot of normalization on init. For instance I have a model that in Ember is 'client/campaign-group' as...
Read more >
Location of Mirage files in ember addon - Stack Overflow
My question is where the mirage directory (and its subdirectories such as factories , fixtures , models , routes etc) should be located...
Read more >
Failed to build the list of regular subfolders - YouTube
If you configured a new GPO which redirects User folders to a new network share, or you click on Reset default location under...
Read more >
Can you use DIR to list files in subfolders ? - MATLAB Answers
Hello,. Would somebody be able to advise me on how to use DIR to find the dates that each file was last modified...
Read more >
git hub snake game
Git Hub Snake GameThere was a problem preparing your codespace, please try again. Available for: Cummins ISX15 | X15 Model Year 2010-2020.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found