From: sto.mar@... Date: 2012-10-20T16:39:47+09:00 Subject: Re: database part of a desktop application Am 19.10.2012 23:16, schrieb Sebastjan H.: > File.open("all_cards.yml", "a+") {|f| YAML.dump(card, f)} > > This appends object after object. Here's the problem. How can I then > access and display certain or all cards after loading the file: > > card_file = YAML.load_file("all_cards.yml") > > I've tried putsing the card_file with different parameters but I always > get back the name of the first objec tin the storage. By appending, you end up with several YAML documents (or objects) in your file. You could iterate through them with: f = File.open('all_cards.yml') YAML.load_documents(f) do |card| p card end Or you could read them all at once with: cards = nil File.open('all_cards.yml') do |f| cards = YAML.load_stream(f) end p cards > And one last question, If I go with YAML and not YAML::Store can I > delete certain card from the storage? Read in all the cards and overwrite your YAML file, leaving out the card you want to delete. --