Closed snoblenet closed 12 years ago
It's using whatever comes with ruby and is already required in by rails.
Each fixture doesn't have a name, because in a database records don't have names.
Check this out:
>> y = "rubyonrails:\n id: 1\n name: Ruby On Rails"
=> "rubyonrails:\n id: 1\n name: Ruby On Rails"
>> YAML.load(y)
=> {"rubyonrails"=>{"name"=>"Ruby On Rails", "id"=>1}}
>> y2 = YAML.load(y).to_yaml
=> "--- \nrubyonrails: \n name: Ruby On Rails\n id: 1\n"
>> YAML.load(y2)
=> {"rubyonrails"=>{"name"=>"Ruby On Rails", "id"=>1}}
>> YAML.load(y)
=> {"rubyonrails"=>{"name"=>"Ruby On Rails", "id"=>1}}
It appears to me that the leading three dashes won't make a difference. But rails' fixtures may certainly be looking for specific things in the yml files.
This tool is designed for getting data from a database to yml and back again. Sounds like it wouldn't be too hard to have a script that would convert these into fixtures (naming them by a key field perhaps), although that's ancillary to my objectives for this gem. (Forks & patches welcome).
What version of the YAML spec does this use?
I ask because I tried dragging the YAML files to spec/fixtures for use as fixtures in Cucumber but first I find I have to reformat the files manually, to:
(i) Give each fixture a name (ii) Remove the hyphen before the ID entry (iii) Remove the three hyphens at the start of the file
This is as per http://api.rubyonrails.org/classes/Fixtures.html