Tuesday, August 7, 2012

Issues in Beginning RhoMobile


Here I'm listing a few mistakes/typos in the book Rhomobile Beginner's Guide.


Chapter 4


Code for cancel button on the filter_employee_form.erb, chapter 4, incorrectly takes you to the index of employees, when It should take you back to the home page. Replace :

<a class="cancel" href="<%= url_for :action => :index %>">Cancel</a>

With

<a class="cancel" href="<%= Rho::RhoConfig.start_path %>">Cancel</a>

Also latest ruby practice is to use link_to instead of <a href style.

Creating a RhoSync application.


Should say where to run the rhosync application. Also rhosync is now replaced by rhoconnect. So starting rhosync with rake is now starting rhoconnect with rake.

Installing the Rhodes translator gem


You must run gem install from the ruby folder or it won't work.

using oci8 with rhoConnect

require 'rubygems'
require 'oci8'

Must remember to use 32 bit oracle client.

Manual install the ruby gem buy using

http://help.rubygems.org/kb/rubygems/installing-gems-with-no-network

I'm using a Windows 2010 64 bit server.

I got my technical staff to install the Oracle Client.  But that was the 64 bit client and is not compatible with the oci8 package.  So had to install the 32bit client.  Make sure is on the path.

Start irb

irb: require 'rubygems'
irb: require 'oci8'

then run:

OCI8.new( 'username', 'password','database-name').exec( 'select * from user_tables' ) {|r| puts r.join }

to test it.  Setting the environment variable oracle_sid is not required.   Database-name will be found using the oracle tnsnames.ora file ( I think).

That works in the irb.  Rhoconenct requires a few more steps.

To get it to work in RhoConnect


  1. open your Gemfile in your application root.
  2. Just under the top line add: gem 'ruby-oci8'
  3. goto to a cmd prompt in your application root.
  4. run bundle install
  5. oracle will now connect!