Rails Load Data into Application every time a New User is Created
Posted
by looloobs
on Stack Overflow
See other posts from Stack Overflow
or by looloobs
Published on 2010-03-28T19:50:22Z
Indexed on
2010/03/28
19:53 UTC
Read the original article
Hit count: 227
Hi I am trying to figure out the "right" way to do this.
In my application every time I create a new user I want to have specific data loaded into an associated table. The associated table is a different preset lists. So a User has many lists and those lists have many items. Some of those Items I want to be loaded when the User is created.
I really don't know how to go about doing this but I am guessing something like: create User after_create: create Lists (need already existing data for the list names) after_create List then populate Items table with existing data for these Lists.
Should I be using seed data for this? Is that alright for production and if so how exactly would I go about doing that.
Any guidance or other recommendations are greatly appreciated.
© Stack Overflow or respective owner