On Sunday 07 June 2009 11:34:55 pm Roy Wright wrote: > Personally I'm spoiled to ORMs. My current favorite is DataMapper > (warts and all). To install: > > gem install dm-core dm-more data_objects do_sqlite3 > > then you can code like: > > require 'rubygems' > require 'dm-core' > > # in memory SQLite3 database > DataMapper.setup :default, 'sqlite3::memory:' > > class Address > include DataMapper::Resource > property :id, Serial > property :street, String, :length => 100 > property :city, :length => 100 > property: state, :length => 3 > > has 0..n, :people, :through => Resource > end > > class Person > include DataMapper::Resource > property :id, Serial > property name, Text > > has 0..n, :addresses, :through => Resource > end > > DataMapper.auto_migrate! > > Now you easily access the data: > > # print everyone with an address in Texas > Address.all(:state => 'TX').each do |addr| > addr.people.each do |person| > puts person.name > end > end > > Much better IMO than SQL... > > Most of the current warts are with the relationships, but the next > branch includes a complete rewrite to address the relationship > problems. This will be version 0.10.0 and should be released > real soon now (tm). :) > > HTH, > Roy > Hi Roy,
thanks for the reply, but not sure i want it in memory (tho it'd be good to do for managing the writes to the DB i guess - have a script that will check all records for changes and any that have get written to file). I'm not too bothered about relationships (aka joins etc) as i see it I want to be able to get at and interact with the data first. thought i read somewhere that datamapper was superseded by something else. you able to help further tho with sqlite3? perhaps via direct email? dave.
