Skip to content

Instantly share code, notes, and snippets.

@ZackMattor
Created July 11, 2013 19:33
Show Gist options
  • Select an option

  • Save ZackMattor/5978509 to your computer and use it in GitHub Desktop.

Select an option

Save ZackMattor/5978509 to your computer and use it in GitHub Desktop.
Doesn't seem to want to load embeded data
class ComponentSerializer < ActiveModel::Serializer
embed :ids
attributes :id,
:back_image,
:cols,
:front_image,
:name,
:rows
has_many :parts, include: true
has_many :element_lights, embed: :objects, include: true
def front_image
"#{object.front_image}"
end
def back_image
"#{object.back_image}"
end
def type
object.class.name
end
end
ServerDemo.Component = ServerDemo.Partable.extend
element_lights: DS.hasMany 'ServerDemo.ElementLight', {embeded: 'always'}
DS.RESTAdapter.map('ServerDemo.Component',{
element_light: {
embedded:'always'
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment