Skip to content

Commit

Permalink
pass userId to changeSelector
Browse files Browse the repository at this point in the history
  • Loading branch information
aldeed committed Apr 23, 2015
1 parent 814a86b commit 5ddf9f2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,14 +183,14 @@ TabularTables.People = new Tabular.Table({
```


## Modifying the selector
## Modifying the Selector

If your table requires the selector to be modified before it's published, you can modify it with the `changeSelector` method. This can be useful for modifying what will be returned in a search.
If your table requires the selector to be modified before it's published, you can modify it with the `changeSelector` method. This can be useful for modifying what will be returned in a search. It's called only on the server.

```js
TabularTables.Posts = new Tabular.Table({
// other properties...
changeSelector: function(selector) {
changeSelector: function(selector, userId) {
// modify it here ...
return selector;
}
Expand Down
2 changes: 1 addition & 1 deletion server/tabular.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ Meteor.publish("tabular_getInfo", function(tableName, selector, sort, skip, limi

// Allow the user to modify the selector before we use it
if (typeof table.changeSelector === 'function') {
selector = table.changeSelector(selector);
selector = table.changeSelector(selector, self.userId);
}

// Apply the server side selector specified in the tabular
Expand Down

0 comments on commit 5ddf9f2

Please sign in to comment.