Ok, I have the following YAML file that was generated using yaml_db for Rails. So this is basically an auto-generated export of my Rails database:
--- admins: columns: - id - username - email - encrypted_password - password_salt - sign_in_count - current_sign_in_at - last_sign_in_at - current_sign_in_ip - last_sign_in_ip - failed_attempts - unlock_token - locked_at - created_at - updated_at records: - - 1 - - lalala@lalala.at - $2a$10$dZU50HD6paWS7EjKuWAruOFdwt9eqxiNTRh/D4sj8cqSzy5gjYd2i - $2a$10$dZU50HD6paWS7EjKuWAruO - 86 - 2011-01-27 07:37:45 Z - 2011-01-26 13:27:13 Z - 12.34.56.78 - 12.34.56.78 - 0 - - - 2010-12-23 09:20:46 Z - 2011-01-27 07:37:45 Z - - 2 - admin - lalalalala@lalalala.com - $2a$10$3DML64hdCCvG90bnhIpN/unEEm6C.a9FqGrAFlFHU0.2D54DSQ1Ni - $2a$10$3DML64hdCCvG90bnhIpN/u - 1 - 2011-01-21 09:52:14 Z - 2011-01-21 09:52:14 Z - 12.34.56.78 - 12.34.56.78 - 0 - - - 2011-01-05 14:29:49 Z - 2011-01-21 09:52:14 Z --- experiments: columns: - id - description - startdate - enddate - maps_base_URI - maps_count - queries_count - proposals_count - created_at - updated_at .......
Now, when I try to load this YAML file into Ruby with:
file = YAML.load(File.open("data-2011-01-27.yml"))
It does not load more than the first admin , not even experiments :
ruby-1.9.2-p0 > file.keys => ["admins"] ruby-1.9.2-p0 > file["admins"]["records"].count => 1
Why? I would suggest that the auto-generated .yml file is syntactically correct? When I run rake:db:dump and rake:db:load , it works fine.
slhck source share