O'Reilly logo

Rhomobile Beginner's Guide by Abhishek Nalwaya

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action Filling data from RhoSync

Let's understand how to transfer data to our employee application using the RhoSync server.

First, update the query method in your source adapter company.rb:

def query(params=nil)
# TODO: Query your backend data source and assign the records
# to a nested hash structure called @result. For example:
@result = {
"1" => {"name" => "Google"},
"2" => {"name" => "Microsoft"}
}
end

In @result, we have hash of hashes where the hash key of the outer hash is the ID of each object (as described above in the query method). Each hash key in the inner hash represents an attribute of an individual object. Whatever value we store in @result, the same values will be sync to device. Note that, all data types must be strings ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required