From: "Matthew, Graeme" Date: 2002-09-20T11:12:57+09:00 Subject: CGI - Ruby Data Types Hi all, me again, jeez im clocking up some traffic, sorry thanks for all your help before, it was just me been stupid and leaving out an enclosing quote for the hash key lookup doh ! Im from a perl background so im having some trouble as I am not used to having to check my data types for example , I have my CGI script cgi = CGI.new id = cgi['id'] prj = Project.new(id) print prj.DisplayProject when I print id.type is states that it is an array ? my project class needs to check the value of id because if it is passed as a valid ie > 0 integer then the user is requesting you to load the data for the project, the problem is it never fails below so when no id is passed then it still tries to execute the SQL def initialize(id) if id db = Db.connection sql = SQL_PROJECT + " WHERE prj_id = #{id} " print sql qry = db.prepare(sql) qry.execute @data = qry.fetch_hash qry.finish end end In a month or two I will probably be thinking how simple this all is but we all have to learn the intricasies, other than that ruby kicks butt as a language, no more worrying about unreadable perl code, or pythons quirks with properties in classes and finally Visual Basic, well they say its a language :-) Thanks again Graeme Matthew Analyst Programmer Mercer Investment Consulting Level 29, 101 Collins Street, Melbourne, VIC, 3001, Australia Tel - 61 3 9245 5352 Fax - 61 3 9245 5330 visit http://www.merceric.com __ ********************************************** This e-mail and any attachments may be confidential or legally privileged. If you received this message in error or are not the intended recipient, you should destroy the e-mail message and any attachments or copies, and you are prohibited from retaining, distributing, disclosing or using any information contained herein. Please inform us of the erroneous delivery by return e-mail. Thank you for your cooperation. ********************************************** ec03/04