Created
December 5, 2011 21:57
-
-
Save ches/1435574 to your computer and use it in GitHub Desktop.
Dev Machinist fixtures
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :db do | |
namespace :fixtures do | |
desc 'Create some dummy development data from factories' | |
task :create => :environment do | |
unless Rails.env.development? || Rails.env.test? | |
puts "This task generates random data and is not intended for use in production." | |
exit 1 | |
end | |
unless admin = User.first(:conditions => { :username => 'admin' }) | |
puts 'Initial user account not found -- be sure to run `rake db:seed` or `db:setup`.' | |
exit 1 | |
end | |
require File.expand_path('spec/support/blueprints', Rails.root) | |
7.times { Note.make!(:owner => admin) } | |
3.times { Note.make!(:public, :owner => admin) } | |
puts "Sample data created!" | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment