You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there anyway to force creation of a record?
I'm using a friendship/reverse-friendship model to create two way associations between objects. When sprig creates a seed record that is in a state of blocked, the system throws the expected message preventing the creation of the reverse-friendship that should also be marked blocked.
In my former seed file, I used an ! exclamation point to force the creation of the two friendships like so:
Peerpartnership.request(seed_consultantaccount, person8).block!
The text was updated successfully, but these errors were encountered:
@ltk I understand that Sprig might have risen from a need on a social networking-like project, is it possible to find out how the team dealt with forcing the creation of records? Presumably the system involved rules that included blocking, etc
Permissions in that project relied on state within records, not really with preventing the creation of records, so we've never encountered this need. But my recommendation for dealing with unconventional circumstances is to use Sprig to insert your records as close to their final intended state, and then manipulate them following the call to Sprig in your seed file. This is one advantage of Sprig not hijacking the db:seed Rake task. You still have a Ruby file where you can do whatever you need.
Per request by @mikesmayer
The text was updated successfully, but these errors were encountered: