Skip to content

Instantly share code, notes, and snippets.

@tooky
Created Sep 12, 2008
Embed
What would you like to do?
$(document).ready(function(){
$('a#save').click(function(event){
event.preventDefault();
$.ajax({
type: "POST",
url: '/items/' + id,
data: $(this).siblings('input').serializeArray(),
dataType: 'json'
});
});
});
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
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment