Created
June 7, 2012 01:05
-
-
Save ArunGupta25/2885848 to your computer and use it in GitHub Desktop.
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
alert("test" + <%= photo %>); |
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
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