Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@caseywatts
Created October 12, 2018 15:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save caseywatts/c5d840862d9693c6a8d84bd2bd83c3d3 to your computer and use it in GitHub Desktop.
Save caseywatts/c5d840862d9693c6a8d84bd2bd83c3d3 to your computer and use it in GitHub Desktop.
Mirage Includes & Relationship Records

Mirage Includes

The way mirage mocks out our included records isn't accurate currently.

An example: In a request for addon, it includes some information about the relationship to company.

The "relationship object" we get looks like

company: { id: 123 }

not

company: 123

Mirage#include

include: ['company', 'categories']
company: {
  id: 123,
  name: "Add-on Company Name",
  email_admin: "the_admin@companyname.com"
}

Mirage#includeIds

include: ['company', 'categories'],
company: 123

not the format our API sends things in ^

HerokuMirageSerializer#includeRelationshipObject

include: ['company', 'categories'],
includeOnlyRelationshipObject: ['company']
company: { id: 123 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment