From: Hassan Schroeder Date: 2013-06-26T00:01:14+09:00 Subject: Re: Beginners problem with database and datamapper On Tue, Jun 25, 2013 at 1:15 AM, cristian cristian wrote: > but I get a lot of errors... > > Any suggestions how to continue? In general, posting the errors you don't understand (or can't figure out by googling) is a good idea :-) > class Stats > include DataMapper::Resource > property :id, Serial > property :date, DateTime > property :url_id, Integer > end class Stat # singular include DataMapper::Resource property :id, Serial property :date, DateTime property :site_id, Integer # use the name of the thing you're referring to end DataMapper.finalize > time=Time.now.strftime("%Y-%m-%d %H:%M") > > Site.all.each do |site| > puts site.url > > Stats.create( > :Date => time, > :url_ID => site.id > ) # randomly capitalizing things doesn't work well :-) Stat.create( :date => time, :site_id => site.id ) > end HTH, -- Hassan Schroeder ------------------------ hassan.schroeder@gmail.com http://about.me/hassanschroeder twitter: @hassan