Railsy scopes in ember store?


What I wanna do is to add “scopes” (like Rails has) in ember when I ask to fetch data from the store (with a get to /resources <-- plural )… so for instance if I have a /users endpoint and I do this.get(‘store’).find(‘users’) and I want to filter only admins, I would like to be able to do this.get(‘store’).find(‘users’).admin or this.get(‘store’).find(‘users’).get(‘isAdmin’).

  1. I know I could have this to the API but I want to be able to do it from the ember side.
  2. I know I can do it using ember enumerables, but I don’t know how to attach the method .admin or the property .get(‘isAdmin’) in the return of find so that I can have chainable scopes (just like Rails does)

Any suggestions ?


Sounds like you want Store#filter with an initial query supplied


That’s cool! I didn’t know about that filter method in the store! Thanks!