-
Notifications
You must be signed in to change notification settings - Fork 481
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 vocabulary model and migrations #38392
Conversation
@@ -807,6 +807,13 @@ | |||
description 'fake description' | |||
end | |||
|
|||
factory :vocabulary do | |||
association :course_version | |||
key 'word' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in order to create more than one of these, I think we will want this to be a sequence, e.g.
sequence(:key) {|n| "objective-#{n}"} |
also, just confirming my understanding that this will be an opaque id generated with something like SecureRandom.uuid
, is that correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was originally thinking that key
would be the word
to start with but I think what you said makes more sense. We'll still need to prevent curriculum writers adding multiple definitions for the same word for now but I think that can be done in other ways. I'll add this sequence to the factory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we consider just getting rid of the key
column and having word
be the key? sorry to add more options here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't be sorry -- I've been going back and forth between a bunch of these options! I thought about that but it's likely we will want to have multiple definitions for a handful of words. I thought about adding the key then but then we'd have to backfill everything already in the database.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to summarize what we talked about offline -- we know we will need to have multiple definitions per word at some point, though not in the near term. We also need a unique identifier that is human-readable-ish in order to embed them in markdown. So, we will set the key to be the word in the near term and, in the future, generate human-readable alternate keys for duplicate definitions, like we do for resources
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me
Adds the model and migrations for the vocabulary model.
I decided to add a key as the spec calls out a likelihood that some courses will have multiple definitions per word (in the case of Common Sense). For now, my plan was to make the key equal to the word.
This PR adds the vocabulary/course version association but the lesson/vocabulary association will come in a later PR in order to limit the number of migrations per PR.
Links
Testing story
Reviewer Checklist: