Skip to content

Instantly share code, notes, and snippets.

@ArunGupta25
Created June 7, 2012 01:05
Show Gist options
  • Save ArunGupta25/2885848 to your computer and use it in GitHub Desktop.
Save ArunGupta25/2885848 to your computer and use it in GitHub Desktop.
alert("test" + <%= photo %>);
def create
@photo = Photo.new(params[:photo])
respond_to do |format|
if @photo.save
format.html { redirect_to @photo, notice: 'Photo was successfully created.' }
format.json { render json: @photo, status: :created, location: @photo }
format.js #added to ajax the creation of a photo and send attr back
else
format.html { render action: "new" }
format.json { render json: @photo.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