Using data from a query fired in rails

athind
Wed, 23 May 2007 06:30:44 -0000

Hello,

I have a query that returns a single number that I want to use further
in my program.

Could you please let me know how I could access the data inside the
object returned by the query.

I invoke it as:

numscens = Progressions.find_by_sql("select numscenarios from
progressions where id = #{params[:progressionid]}

The data in numscens that I get is  >> numscenarios.to_xml:

<?xml version="1.0" encoding="UTF-8"?>
<resultdetails>
  <resultdetail>
    <numscenarios type="integer">2</numscenarios>
  </resultdetail>
</resultdetails>

I want to access the number in the numscenarios tag.

Apologies for the novice question.

Many Thanks,
Aman