Skip to content
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

fix to custom appointment notes not showing up #253

Merged
merged 1 commit into from
Nov 9, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions app/models/note.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ class Note < ActiveRecord::Base
validates_inclusion_of :reason, in: Proc.new { |note| note.notable_type.constantize::NOTABLE_REASONS },
if: Proc.new { |note| note.reason.present? }

# required so that custom appointment notes will show. up. taken from the rails documentation, http://api.rubyonrails.org/classes/ActiveRecord/Associations/ClassMethods.html#label-Polymorphic+Associations

def notable_type=(class_name)
super(class_name.constantize.base_class.to_s)
end

def comment
case kind
when 'followup'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class SwtichCustomAppointmentNotesToAppointment < ActiveRecord::Migration
def change
Note.where(notable_type: 'CustomAppointment').update_all(notable_type: 'Appointment')
end
end