Fixed deprecation warnings on generated active record scopes

Closes #414