Skip to content
This repository has been archived by the owner on Apr 30, 2018. It is now read-only.

Commit

Permalink
Debug medications
Browse files Browse the repository at this point in the history
  • Loading branch information
justinbarclay committed Mar 19, 2017
1 parent 813e2e1 commit 68d66a9
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions app/controllers/medical_records_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,10 @@ def create_medications(medications, medical_record_id)
success = nil
medication_records = parse_medications(medications, medical_record_id)
Medication.transaction do
puts medication_records.to_json
success = medication_records.map(&:save)
unless success.all?
puts "error"
raise ActiveRecord::Rollback
end
end
Expand Down
2 changes: 1 addition & 1 deletion app/models/medical_record.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class MedicalRecord < ApplicationRecord
validates :temperature, presence: true, allow_blank: true, numericality: true
validates :signature, presence: true, allow_blank: true

validates :date, presence: true, allow_blank: true
validates :date, presence: true, allow_blank: true, numericality: true

validates :exam_notes, presence: true, allow_blank: true

Expand Down
2 changes: 1 addition & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

get 'patients/:patient_id/images/:id', to: 'images#show'
get 'patients/:patient_id/images/filter/:id', to: 'images#filter'
post 'patients/:patient_id/images', to: 'images#create'
post 'patients/:patient_id/images', to: 'images#create'

resources :users
resources :patients do
Expand Down

0 comments on commit 68d66a9

Please sign in to comment.