class Api::PhotosController

Public Instance Methods

create() click to toggle source

Post a photo

Param:: photo[image] => the image to be uploaded [.png|.gif|.jpeg]
Param:: photo[cutout_id] => the id of the associated cutout object
Example

../photos (NB: data must be sent a POST request)

Format

JSON

Method

POST

  • Returns :

    • newly created photo object

# File photos_controller.rb, line 59
def create
  @res = Photo.create(params, request)
              
  respond_to do |format|
    if not @res['error']
      format.html { redirect_to @res['item'], :notice => 'Photo was successfully created.' }
      format.json { render :json => @res, :status => :created, :location => @res['item'] }
    else
      format.html { render :action => "new" }
      format.json { render :json => @res, :status => :unprocessable_entity }
    end
  end
end