I'm migrating data between two activerecord connections, I've got my models all setup correctly so I can read from say Legacy::Tablename and Tablename and insert it into the new table.
The problem I have is my new model doesn't have all of the attributes that are in the legacy model so I get an 'unknown attribute' when I try to create a record in the new model via;
legacy_users = Legacy::User.all
legacy_users.each do |legacy_user|
User.create legacy_user.attributes
end
however if I try to remove the offending attribute it still doesn't work eg.
legacy_user.attributes.delete 'some_attribute'
Can anyone offer any pointers?
How about attributes.except(:some_attribute)?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With