Skip to content

Instantly share code, notes, and snippets.

@elisehuard
Created December 8, 2009 08:40
Show Gist options
  • Save elisehuard/251526 to your computer and use it in GitHub Desktop.
Save elisehuard/251526 to your computer and use it in GitHub Desktop.
def post(method_name, options = {}, body = nil)
request_body = body.blank? ? encode : body
if new?
# connection.post(custom_method_new_element_url(method_name, options), request_body, self.class.headers)
# elise fix
connection.post(custom_method_new_element_url(method_name, options), request_body, self.class.headers).tap do |response|
.id self= id_from_response(response)
load_attributes_from_response(response)
end
self
else
connection.post(custom_method_element_url(method_name, options), request_body, self.class.headers)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment