move queries to scope
move queries to scopes and refactor
refactoring, moving code from controller to model, pending spec
eliminating duplication with a base controller class
Merge pull request #1 from RafaelChefe/refactoring

Refactoring