Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use variables in seed files #124

Open
garethfr opened this issue Nov 8, 2022 · 1 comment
Open

Use variables in seed files #124

garethfr opened this issue Nov 8, 2022 · 1 comment

Comments

@garethfr
Copy link

garethfr commented Nov 8, 2022

Is it possible to use variables in seed files?

For example use admin_email variable as follows:

owner_id: "<%= sprig_record(User, admin_email).id %>"

This will allow me to use a different value in dev / staging / prod environments.

I know I can create different seed files for each environment, but I want to avoid duplicating the data when only one field is different.

@efatsi
Copy link
Contributor

efatsi commented Nov 11, 2022

Would be doable, but tricky. Requiring updates to https://github.com/vigetlabs/sprig/blob/master/lib/sprig/seed/attribute.rb#L26-L27. If you want to take a crack at it, we would review a PR submission. There is no current active development on this project though.

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

No branches or pull requests

2 participants