This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
| e7b345cc » | dfl | 2008-06-14 | 1 | desc "Generate factory templates from database schema; takes optional MODEL= argument" | |
| 2064da73 » | dfl | 2008-06-14 | 2 | ||
| 3 | namespace :factory do | ||||
| 4 | |||||
| 5 | task :generate do | ||||
| 6 | require File.join( RAILS_ROOT, 'config', 'environment' ) | ||||
| 7 | |||||
| 8 | if arg = ENV['model'] || ENV['MODEL'] | ||||
| 9 | puts Factory.generate_template( arg ) | ||||
| 10 | else | ||||
| d2445a87 » | dfl | 2008-06-14 | 11 | all_models = Dir.glob( File.join( RAILS_ROOT, 'app', 'models', '*.rb') ).map{|path| path[/.+\/(.+).rb/, 1] } | |
| 2064da73 » | dfl | 2008-06-14 | 12 | all_models.select{|m| m.classify.constantize < ActiveRecord::Base}.each do |model| | |
| 13 | puts Factory.generate_template( model ) | ||||
| 14 | end | ||||
| 15 | end | ||||
| 16 | end | ||||
| 17 | |||||
| 18 | end | ||||







