I am building a rails 6 app and I am stuck on an issue.
Let's say I have a table tasks which has 3 fields:
- id
- state
- description
The description field is in fact a rich_text field thanks to ActionText.
My problem is that I have a csv file composed of 3 columns (id, state, description) and, during initialization of the app, I want to populate my database with it, using bulk import.
Normally, if description was a normal column, I would do something like this:
Task.insert_all(
# My csv converted in array of hashes [{state: YY, description: ZZZZZZZ}]
)
But as description is not really an attribute of the table tasks, it won't work. How can I still use bulk import to import large set of data, but still use action_text fields?
Right now, I am forced to use "one by one" insertions which takes a very long time!
Thank you for any leads you can bring.