remove repeated logic at controller
use respond_with instead of respond_to
passed all tests