Skip to content

Conversation

whatcould
Copy link

This provides a way to set defaults on each model — without adding an extra column to the CSV.

Some potential uses could be batch number, imported_by, etc etc.

@whatcould
Copy link
Author

Note that these are added before the find_model step, so you can use these defaults as part of the identifiers to look up existing records.

@pcreux
Copy link
Owner

pcreux commented Sep 16, 2024

Hey @whatcould ! Thank you for your PR.

I was about to say you could use after_build to set defaults, but it doesn't allow you to use these defaults as part of the identifiers to look up existing records. since it's called after find_or_build.

What about updating the flow to call after_build in build_model instead of after find_or_build.

That way, we wouldn't introduce a new way to set default values, and I believe that it would also improve the current behavior: calling after_build on existing models can seem counterintuitive.

Thoughts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants