Created
October 5, 2013 20:48
-
-
Save JKring/6845841 to your computer and use it in GitHub Desktop.
async photo uploading
This file contains 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
def upload_photo | |
event = Event.find(params[:event_id]) | |
params.delete(:event_id) | |
icon = EventIcon.create(params) | |
# This requires setting up a many-to-one relationship between icons and events | |
event.icons << icon | |
event.save! | |
render json: { | |
id: icon.id, | |
name: icon.photo_file_name, | |
url: icon.photo.url | |
} | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment