Skip to content

Instantly share code, notes, and snippets.

@chadmoone
Created October 7, 2011 21:24
Show Gist options
  • Save chadmoone/1271379 to your computer and use it in GitHub Desktop.
Save chadmoone/1271379 to your computer and use it in GitHub Desktop.
lock issues
def update
@text_frame = TextFrame.find(params[:id])
# lock already exists, so this will return the existing lock
lock = Lock.new(current_user, @text_frame, "text_frame", params[:text_frame][:last_modified])
if (!lock.save)
# handle error here, send bad status code and message
end
@text_frame.update_attributes(params[:text_frame])
lock.destroy # now we've destroyed the lock that we didn't create and was supposed to be left
respond_with @text_frame
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment