I have the following migration which is migrating data from an old table to
a new table named lists:
self[:lists].insert([:name, :item_name, :type, :account_id,
:old_tag_id],
self[:tags].select(:name, :name, "contacts",
:account_id, :id))
I also want to add 2 rows into another table for every row that is inserted
into the lists table in this migration.
The List model class from the self[:lists] of the above insert has the
following after_model hook
def after_create
super
ListStatus.create(name: 'active', position: 1, list: self)
ListStatus.create(name: 'inactive', position: 2, list: self)
end
This after_create hook is obviously not ran when records are inserted via a
migration.
How can I best insert the 2 records in a migration which does not involve
using the List model object?
--
You received this message because you are subscribed to the Google Groups
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.