Doctor question model crud - #180
Conversation
35f76af to
ecdf4a4
Compare
dpowers1
left a comment
There was a problem hiding this comment.
The migrations thing is the only blocker. This looks really good!!
| @@ -0,0 +1,11 @@ | |||
| class CreateDoctorQuestions < ActiveRecord::Migration[8.1] | |||
There was a problem hiding this comment.
Could we roll these 3 migrations on the doctor_questions table into 1?
There was a problem hiding this comment.
Ack. Done.
| @doctor_questions = DoctorQuestion.sorted_by(params[:sort], params[:direction]) | ||
| end | ||
|
|
||
|
|
There was a problem hiding this comment.
Ack. Removed.
| @@ -0,0 +1,2 @@ | |||
| module DoctorQuestionTypesHelper | |||
|
|
||
| # Whitelist. Never interpolate a query parameter into an ORDER BY: anything | ||
| # not in this hash falls back to the default rather than reaching SQL, which | ||
| # is what makes the Arel.sql below safe to write. |
There was a problem hiding this comment.
NIT: Probably dont need this comment
There was a problem hiding this comment.
Ack. Reduced to one line.
|
|
||
| questions.each do |question| | ||
| type.doctor_questions.find_or_create_by!(question: question) | ||
| end |
There was a problem hiding this comment.
Adding the raw data to the seed here isn't incorrect but something to consider would to be spliting this into its own file and loading all seeds programmatically. Some reading on the subject https://medium.com/@ethanryan/split-your-rails-seeds-file-into-separate-files-in-different-folders-3c57be765818
There was a problem hiding this comment.
Ack. Updated.
|
Posting a new commit with changes. |
18689f0 to
0bffb3e
Compare
What this does
Add the MVC & rudimentary business logic for DoctorQuestions and DoctorQuestionTypes
Issue
Closes #165
Testing