Given the following models:
class Uptime < ActiveRecord::Base
has_many :pings
end
class Ping < ActiveRecord::Base
belongs_to :uptime
end
I can create an ActiveResource that will get the uptimes and ping
models:
class UptimeResource < ActiveResource::Base
self.site = “http://localhost:3000”
self.element_name = “uptime”
end
class PingResource < UptimeResource
self.element_name = “ping”
end
If the information exists in the database, I can do
UptimeResource.find(1).pings and get a list of pings. But how can I
create pings besides creating an UptimeResource and then creating the
pings separately. I am trying to save the XML into an XML Database and
bypass a relational database (client requirements). I wish I had
something like CouchDB_fu but for XML databases…
Is this a job for DataMapper? I am open to any strategy. Swift kicks
to the head welcome.
Carl