Warning Older Docs! - You are viewing documentation for a previous released version of RhoMobile Suite.

RhoApplication API

Access methods for Rhodes applications. Refer to File System access in Device Capabilities for examples using file access and for information on file access on different device platforms.

Using JavaScript API

You can call the RhoApplication methods from JavaScript as well as Ruby. To use the JavaScript API, add the public/js/rho_javascript_api.js file – created at build time as part of the application package – to the .html, .erb, or .js file calling the JavaScript method.

The JavaScript API methods with a return value can pass it as a parameter in jQuery-compatible continuation (deferred object, a kind of callback). Possible continuations to handle are done, fail, and complete.

Rho.Class.method(params).done(function(handler) { /* handler... */ })

You must enable JavaScript by putting rho-javascript into extensions in your build.yml.

extensions: ["rho-javascript"]

You must have a RhoElements license to use the JavaScript API.


Returns a string that contains the absolute path to the application. See get_user_path for information about getting paths with iOS.

Ruby syntax:


JavaScript syntax:



Returns a string that contains the absolute path path to the given relative path in the application.

Ruby syntax:


JavaScript syntax:

relativePath String. The relative path in the application.


Returns a string that contains the absolute path to a model folder in the application.

Ruby syntax:

Rho::RhoApplication.get_model_path('app', model)

JavaScript syntax:

Rho::RhoApplication.get_model_path('app', model)
'app' Always set the first parameter in get_model_path to 'app'.
model String. The model name.


Returns the real path to a blob (such as a digital photo). You need to use this method to have the correct path to a blob attribute.

Ruby syntax:


JavaScript syntax:

relativeFilePath String. The path to the blob file.


Returns the absolute path to the folder where blobs, such as digital photos, are created in this application.

Ruby syntax:


JavaScript syntax:



Returns the path to the user folder. iOS only.

On the iOS platform, only the files stored in the Documents folder are backed up in iCloud. Before Rhodes 3.3.2, all files were stored in the Documents folder. Apple requires that the Documents folder only contains files that the user created and works with directly: other files should not be created there.

From Rhodes 3.3.2 and on, all files except databases are stored in /Library/Caches/Private Documents/. Files in this folder are not backed up to iCloud. To make those files back up, you can put the files into the user folder. Get that path with get_user_path. All your files created in Rhodes versions before 3.3.2 in Rho::RhoApplication.get_base_app_path, now should be created in Rho::RhoApplication.get_user_path.

Ruby syntax:


JavaScript syntax:

Back to Top