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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
What is numscenarios? if it is a column name then you should be able to access it like any active record find. NOTE: you can''t update unless you have the id field. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---