Skip to content

Instantly share code, notes, and snippets.

@fabrinal
Created June 1, 2015 12:39
Show Gist options
  • Save fabrinal/5e1049a7840c0c751fa3 to your computer and use it in GitHub Desktop.
Save fabrinal/5e1049a7840c0c751fa3 to your computer and use it in GitHub Desktop.
Create method in photo_galleries_controller.rb
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