you are getting that error because this

> @loo = sql.execute("select count(name) from data1.items").fetch_row;

is returning the count as an array.

to get this working you need to call @loo.first.to_i

but why are you not using

Item.count or Item.count(:name)

that will straight away give you the count number that you dont have
to convert to integer as well


nas

http://nasir.wordpress.com
http://twitter.com/_nasj
http://github.com/nas

On Nov 18, 5:26 am, INDRANIL MUKHERJEE <[email protected]>
wrote:
> **this is the error:
>
> undefined method `to_i' for ["5"]:Array
>
> **this is the code:
>
> sql = ActiveRecord::Base.connection();
> @loo = sql.execute("select count(name) from data1.items").fetch_row;
>
> @loo = @loo.to_i
>
> Plz help; it is urgent.
>
> regards,
>
> INDRANIL MUKHERJEE

--

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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=.


Reply via email to