update_hash.delete?

19 views
Skip to first unread message

jwargo

unread,
Apr 10, 2012, 9:12:42 AM4/10/12
to rhom...@googlegroups.com
Looking at one of the examples for Update, the source adapter has the following code:

obj_id = update_hash['id']
update_hash.delete('id')  
RestClient.put("#{@base}/#{obj_id}",:product => update_hash)

What’s the point of the update_hash.delete(‘id’)? What does that affect?

Mark Zweedijk

unread,
Apr 10, 2012, 11:09:22 AM4/10/12
to rhom...@googlegroups.com
http://docs.rhomobile.com/rhoconnect/source-adapters#handling-conflicts 

As I can see the point is that they don't have a update-method. So they first delete the existing record and then create a new one. If the http-code is different then 200, they raise an exception. I hope this was your question.

Op dinsdag 10 april 2012 15:12:42 UTC+2 schreef jwargo het volgende:

ad...@rhomobile.com

unread,
Apr 10, 2012, 11:15:15 AM4/10/12
to rhom...@googlegroups.com, rhom...@googlegroups.com
Nope

It is just removing the ID attribute before submitting the update to the backend REST service 

Sent from my iPhone
--
You received this message because you are subscribed to the Google Groups "rhomobile" group.
To view this discussion on the web visit https://groups.google.com/d/msg/rhomobile/-/uKstyJk3XXMJ.
To post to this group, send email to rhom...@googlegroups.com.
To unsubscribe from this group, send email to rhomobile+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rhomobile?hl=en.

Burgess Lars-KDWC48

unread,
Apr 10, 2012, 11:16:13 AM4/10/12
to <rhomobile@googlegroups.com>
Hello,

The reason this sample code deletes the 'id' is because it is an additional attribute not required by this particular web service.

-Lars

Reply all
Reply to author
Forward
0 new messages