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

Add #seed method to factory? #783

Open
robacarp opened this issue Jan 5, 2022 · 0 comments
Open

Add #seed method to factory? #783

robacarp opened this issue Jan 5, 2022 · 0 comments

Comments

@robacarp
Copy link
Contributor

robacarp commented Jan 5, 2022

related to luckyframework/lucky_cli#677

I have a feature flagging system in my app which allows me to ask "can a user do X?", each feature is stored in the database and can be enabled on a per-user or system wide basis. When I add a feature to the code, the answer is always "no" until I add the feature record to the database. In production this means shelling into the database and manually inserting a record! 🔥 ↔️ 🚒

Adding a #seed method to Factory might make this easier if it:

  • assembles a list of attributes which are set by the factory.create block
  • checks for a matching record and returns it if it exists
  • delegates to #create if it doesn't exist.

Is that worth doing?

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

1 participant