From: Hassan Schroeder Date: 2013-06-21T01:22:03+09:00 Subject: Re: Beginners problem with database and datamapper On Thu, Jun 20, 2013 at 6:09 AM, cristian cristian wrote: > Should I query the rows one by one? > Should I query the whole table store into a hash and the loop through? > When I fetch the row how can I get the column URL? I would suggest you read http://datamapper.org/getting-started.html and try thinking in OO terms. The whole point of an ORM is to deal with *objects*, not rows in a database. ------- snip ------ > int = 0 > num = 3 > > #What to do here? > while int ds = Url.get(int) > #ds has the first row. Now how do I get the column 'URL'? Throw all of the above away :-) class Site # I'd rename your Url class include DataMapper::Resource property :id, Serial property :description, String property :url, String # url in lowercase end Site.all.each do |site| puts site.url end HTH, -- Hassan Schroeder ------------------------ hassan.schroeder@gmail.com http://about.me/hassanschroeder twitter: @hassan