Autocomplete fix rails3

Fixes #192 for the rails3.x branch.