This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require "open-uri" | |
| class PhotosController < ApplicationController | |
| def update | |
| photo = Photo.find(params[:id]) | |
| # Open the url that's been returned by Filepicker. | |
| # Then remove the pic from params so it doesn't get updated | |
| # via update_attributes, which will cause a validation error | |
| if params[:photo][:pic_selected] == "true" && params[:photo][:pic] != '/default_images/original/missing.png' | |
| url = params[:photo][:pic] |