refactor photos with activerecord models