I use faker to create sample data. I have the following:
require 'faker'
namespace :db do
desc "Fill database with sample data"
task :populate => :environment do
Rake::Task['db:reset'].invoke
User.create!(:name => "rails",
:email => "example@railstutorial.org",
:password => "foobar",
:password_confirmation => "foobar")
99.times do |n|
name = "rails#{n+1}"
email = "example-#{n+1}@railstutorial.org"
password = "password"
user = User.create!(:name => name,
:email => email,
:password => password,
:password_confirmation => password)
end
end
end
The problem is that I have a couple of after_save callbacks that are not called when creating the Account. Why is this? Thanks
Methods
after_save :create_profile
def create_profile
self.build_profile()
end
source
share