forked from tower-archive/tower
-
Notifications
You must be signed in to change notification settings - Fork 0
pubsub
Lance Pollard edited this page Apr 23, 2012
·
1 revision
- no real security w/o passing through the controller layer
class App.User extends Tower.Model
@sync()
@publish()
@subscribe()
@scope "recent", @where(createdAt: ">=": -> _(2).days().ago()).sync()
Need to figure out authorization method first, but this will definitely be more secure.
class App.User extends Tower.Model
@recent: (currentUserId) ->
# holds permissions
@where(createdAt: ">=": -> _(2).days().ago()).where(adminId: currentUserId)
class App.UsersController extends App.Controller
@sync "recent", -> @currentUser.get('id')