change scopes to use proc so it works in rails 3 and 4