Reputation: 187
I'm using devise to handle my users and as part of my application each user has their own 'todo' list. I'm trying to create 5 items in a new list every time a new user is created (so they have some sample data).
What is the best way to do this? I've looked at migrations and seed.rb but these don't seem to meet my needs.
Any help would be really appreciated!
Cheers!
Upvotes: 2
Views: 165
Reputation: 230396
use :after_create
hook.
class User < ActiveRecord::Base
after_create :populate_todo
private
def populate_todo
# do your stuff here
end
end
Upvotes: 1