Created
June 1, 2015 12:39
-
-
Save fabrinal/5e1049a7840c0c751fa3 to your computer and use it in GitHub Desktop.
Create method in photo_galleries_controller.rb
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 create | |
@photo_gallery = PhotoGallery.new(photo_gallery_params) | |
respond_to do |format| | |
if @photo_gallery.save | |
# add save photos method in here | |
save_photos(params[:photos]) | |
format.html { redirect_to @photo_gallery, notice: 'Photo gallery was successfully created.' } | |
format.json { render :show, status: :created, location: @photo_gallery } | |
else | |
format.html { render :new } | |
format.json { render json: @photo_gallery.errors, status: :unprocessable_entity } | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment