make collect_ids work with associations and named scopes
Merge pull request #1 from makandra/fix/collect_ids

Fix: Collect ids