Maybe slightly off-topic, but I was watching debate about fixtures
order loading. I didn't like much the idea of deferring constraints
(DB engine dependency) but I really like Fixtures Scenarios plugin.
Wish this would get into the core some day.
So I patched it the way it is possible to name fixtures' files
similiar to migrations:

001_offices.yml, 002_departments.yml, 003_users.yml


The patch follows:
--- fixture_scenarios.rb.orig   2007-08-15 13:24:17.000000000 +0200
+++ fixture_scenarios.rb        2007-08-15 14:02:36.000000000 +0200
@@ -214,3 +214,3 @@
         scenario_paths.each do |path|
-          yaml_files |= Dir.glob("#{path}/*.y{am,m}l")
+          yaml_files |= Dir.glob("#{path}/*.y{am,m}l").sort
           ruby_files |= Dir.glob("#{path}/*.rb")
@@ -222,3 +222,4 @@
           file_name = file_path.split("/").last
-          table_name = file_name[0..file_name.rindex('.') - 1]
+          start_pos = file_name =~ /^\d+_/ ? file_name.index('_') +
1 : 0
+          table_name = file_name[start_pos..file_name.rindex('.') -
1]
           table_names << table_name


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to