Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Previously, seeding the database runs into multiple issues.
has_answer
to true, and needs to refer to the "Answer" post type, so we need to first create the answer post type before we can create the "Question" post type.For the first, I have added a bit of code to prioritize models on which others depend.
For the second, I have flipped the order of the Post types in the file and added ids. The import scripts (and potentially some code) rely on the fact that id for the "Question" post type is 1 and that the id for the "Answer" post type is 2, therefore I added the ids to ensure they are set that way.
For the third point, I added a confirmed at date for the admin user to ensure that devise does not try to send a confirmation mail. Otherwise it crashes in
devise/mailer/confirmation_instructions.html.erb
on line 11 since there is noRequestContext
while seeding.For the last point, I added
.id
such that it actually gets the ids and not the instances.Fixes #638