Newer
Older
before_filter :authenticate_user!
respond_to :html
respond_to :json, :only => :show
album = Album.find_by_id params[:album_id]
@photo = current_user.post(:photo, params)
respond_with @photo
message = "Photo upload failed. Are you sure an image was added?"
respond_with :location => album, :error => message
rescue CarrierWave::IntegrityError
message = "Photo upload failed. Are you sure that was an image?"
respond_with :location => album, :error => message
rescue RuntimeError => e
message = "Photo upload failed. Are you sure that your seatbelt is fastened?"
respond_with :location => album, :error => message
raise e
@album = current_user.album_by_id(params[:album_id])
@photo = Photo.find_by_id params[:id]
respond_with :location => @photo.album
@photo = Photo.find_by_id params[:id]
respond_with @photo, @album
def edit
@photo = Photo.find_by_id params[:id]
@album = @photo.album
end
def update
@photo = Photo.find_by_id params[:id]
@photo.update_attributes params[:photo]
respond_with @photo