You could download my app, where I had used a helper method to determine the designations of employees based on their age. Though that might sound a little wiered, its just to demo how we can define our own functions and use them in the views :
Hope it helps.
While moving code to rb file from erb, you have to remove embedded tags. You can try the below code
content = ""
content += "<h1>Home</h1>"
if SyncEngine::logged_in > 0
content +="<a href='/app/Settings/do_sync' class='ui-btn-left' data-icon='refresh'>Sync</a>"
content += "<a href='/app/Settings/login' class='ui-btn-left' data-icon='refresh'>Login</a>"
Placed the code in application helper file. You must include the helper in the necessary controller file like
Now you can call the helper method in erb file as
<div data-role="header" data-position="inline">
<%= header_data %>
Hope this might be helpful
Another effective way of cleaning the view is to move the code to partials and render the partial wherever needed. See http://docs.rhomobile.com/rhodes/ui#advanced-usage-of-render for rendering partials