Fix checking chained SQL calls in scopes

Should fix #471.

Also expands `scope` call checking to Rails 4.