Replaced deprecated method named_scope for scope