fix deprecated scopes, finders, associations for rails 4