Mobilizing Your Application wiki tutorial

1 view
Skip to first unread message

Sarah Allen

unread,
Jul 1, 2009, 2:26:03 AM7/1/09
to rhom...@googlegroups.com
Hi,


It says:
The base class sync method expects to work on an @result variable that is in "Generic Results" form. Specifically this is a HASH OF HASHES where the hash key of the outer hash is the ID of each object. Each hash key in the inner hash represents an attribute of an individual object. Note that ALL DATATYPES MUST BE OF TYPE STRING (so the hash values need to all be strings not integers). For example:

 @result={"1"=>{"name"=>"Acme","industry"=>"Electronics"},"2"=>{"name"=>"Best","industry"=>"Software"}}


But it appears from looking at the code that the result format is expected to be an array.  Sure enough if I do the following experiment, I can see results in the RhoSync app:

 def sync
      @result = [{"id"=>"1", "name"=>"Acme","industry"=>"Electronics"},{"id"=>"2", "name"=>"Best","industry"=>"Software"}]
      super
  end

I assume that is just some old cruft in the wiki, but let me know if I'm missing something.

The tutorial also references a lighthouse app which looks like it used to be in git:
but has since been removed.


Please let me know if I'm looking in the right places or if there are some other docs I should be digging into while exploring Rhodes.

Thanks,
Sarah

Adam Blum

unread,
Jul 1, 2009, 10:28:40 AM7/1/09
to rhom...@googlegroups.com, rhom...@googlegroups.com
Sarah,

The current Rhosync base source adapter class sync code in master (1.2 unstable) expects a hash of hashes. At one point the source adapter sync method expected an array of hashes.  I believe the wiki and current master both refer to an array of hashes now.

 Sorry if you got caught in the timing of the change. That said, if its working there's nothing really "wrong" with using an array of hashes. We just got feedback that a hash of hashes is a little better, which I tend to agree with. 

Sent from my iPhone

Sarah Allen

unread,
Jul 1, 2009, 10:38:49 AM7/1/09
to rhom...@googlegroups.com
You are correct.  I was using 1-1-stable. I do think that using a hash with the id for a hash key makes for a better API.  I'm inclined to move to master just so I'm working with the latest... are there any other API changes I should be aware of? or would you recommend I stick with 1-1 for the moment.

Thanks,
Sarah

Adam Blum

unread,
Jul 1, 2009, 10:43:13 AM7/1/09
to rhom...@googlegroups.com, rhom...@googlegroups.com
Sarah,

I would recommend working off of 1.2 unstable, at least for rhosync that is. 

Adam

Sent from my iPhone
Reply all
Reply to author
Forward
0 new messages