Skip to content

Instantly share code, notes, and snippets.

@dvv
Created July 14, 2010 22:19
Show Gist options
  • Save dvv/476190 to your computer and use it in GitHub Desktop.
Save dvv/476190 to your computer and use it in GitHub Desktop.
MoreRestrictive: (model, methods) ->
Facet.Restrictive model, h.apply methods, {
query: (q, options) ->
#if typeof q is 'string'
# # handle $-parameters
# # TODO: consider security issues
# if options?.parameters
# q: q.replace /\$[1-9]/g, (param) ->
# options.parameters[param.substring(1) - 1]
q: RQ.parseQuery q
q.args.unshift {name: 'limit', args: [this.maxLimit or 100]} # ,0,Infinity
#h.dir 'QQQ:', q
model.query(q, options)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment