Skip to content

Instantly share code, notes, and snippets.

@tooky
Created September 12, 2008 15:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tooky/10462 to your computer and use it in GitHub Desktop.
Save tooky/10462 to your computer and use it in GitHub Desktop.
$(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