Put rake task outside production environment

This commit is contained in:
benji 2015-09-11 17:26:23 +02:00
parent f9b6f17456
commit dedd27cf52

View file

@ -1,11 +1,11 @@
require 'factory_girl'
require 'faker'
task :sow => :environment do
users = FactoryGirl.create_list(:user, 20)
100.times do
sample_users = users.sample(2)
FactoryGirl.create :transaction, debtor: sample_users[0], creditor: sample_users[1], amount: 1 + rand(100)
unless Rails.env.production?
require 'factory_girl'
require 'faker'
task :sow => :environment do
users = FactoryGirl.create_list(:user, 20)
100.times do
sample_users = users.sample(2)
FactoryGirl.create :transaction, debtor: sample_users[0], creditor: sample_users[1], amount: 1 + rand(100)
end
end
end