avram
avram copied to clipboard
Add #seed method to factory?
related to https://github.com/luckyframework/lucky_cli/issues/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?