Forums | Admin

Discussion Forums: help

Start New Thread Start New Thread

 

By: Evandro Rodrigues
Rails Informix with Informix 7.31 [ reply ]  
2008-10-02 17:11
I was wondering to access Informix 7.31 from rails.
I follow the gem intallation process to install ruby-informix 0.7.2 and after rails-informix-1.1.0.
First testing on IBM Informix Dynamic Server Version 11.50.UC1DE and all was gracefull works... Nice.
Then after, I tried to point my sqlhosts to an Informix Dynamic Server Version 7.31.UD1 server and the adventure begins...First there was some messages regarding extend_id ausence, no problem, after some fix sugested by Gerardo Santana the ruby driver starts to work with Informix 7.31.
Then I was create a model (called route) on a Rails test application, to represent a table on database, but when I run a command like Route.find(:first) in the Rails console I have:
>> Route.find(:first)
=> [#<Route >]

When the correct needs to be something like:
>> Route.find(:first)
=> #<Route route_id: 198, route_code: "20 ", operator_id: 1, description: "City - Shirley ", outbound_desc: "Shirley ", inbound_desc: "City ">
As I had when running in Informix 11.50

Running the following program, I have the same response from both database servers, them the problem seems to be on informix rails connector. I'm starting working with rails and all help will be appreciated.

Example Program that works on Informix 7.31 an 11.50
require 'rubygems'
require 'informix'

Informix.connect('centurion@centlive_tcp', 'dbmaster', 'XXXXXX') {|conn|
sql="SELECT * FROM route"
conn.cursor(sql) { |cur|
cur.open
cur.each_hash { |row|
puts "#{row['route_id']} - #{row['route_code']} - #{row['operator_id']} - #{row['description']} - #{row['outbound_desc']} - #{row['inbound_desc']}"
}
}
}