Skip to content

Instantly share code, notes, and snippets.

@jimsynz
Created November 25, 2012 23:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jimsynz/4145908 to your computer and use it in GitHub Desktop.
Save jimsynz/4145908 to your computer and use it in GitHub Desktop.
Heap.User = DS.Model.extend
heaplogs: DS.hasMany('Heap.Heaplog')
name: DS.attr 'string'
nickname: DS.attr 'string'
location: DS.attr 'string'
image: DS.attr 'string'
description: DS.attr 'string'
extra_url: DS.attr 'string'
Heap.User = Heap.User.reopenClass
withNickname: (nickname)->
matching_users = Heap.store.filter Heap.User, (data)->
data.nickname == nickname
return matching_users.get('lastObject') if matching_users.get('length') > 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment