**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 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://twitter.com/_nasj