Skip to content

Instantly share code, notes, and snippets.

View tooky's full-sized avatar

Steve Tooke tooky

View GitHub Profile
class Items < ActiveRecord::Base
def update
@item = Items.find(params[:id])
raise NotFound unless @item
if @item.update_attributes(params[:item])
redirect url(:item, item)
else
raise BadRequest
end
end
r.match('/designer/:photo_id/crop').name(:cropper) do |cropper|
cropper.match(:method => :get).to(:controller => 'crops', :action => 'new')
cropper.match(:method => :post).to(:controller => 'crops', :action => 'create')
end
def create
only_provides :json
if params[:Filedata]
@photo = Photo.new_from_filedata(params[:Filedata])
if @photo.save
render '', :status => 200
else
raise NotAcceptable
end
else