diff --git a/app/controllers/concerns/case_note_concern.rb b/app/controllers/concerns/case_note_concern.rb index 986f583d1..2b1ca2737 100644 --- a/app/controllers/concerns/case_note_concern.rb +++ b/app/controllers/concerns/case_note_concern.rb @@ -17,7 +17,7 @@ def permit_case_note_params :meeting_date, :attendee, :interaction_type, :custom, :note, :custom_assessment_setting_id, :draft, case_note_domain_groups_attributes: [ :id, :note, :domain_group_id, :task_ids - ] + ] ) end diff --git a/app/models/enrollment.rb b/app/models/enrollment.rb index 453950d5b..6ae8742b0 100644 --- a/app/models/enrollment.rb +++ b/app/models/enrollment.rb @@ -56,9 +56,9 @@ def self.properties_by(value) # def short_enrollment_date # enrollment_date.end_of_month.strftime '%b-%y' # end - def self.cache_program_steams - Rails.cache.fetch([Apartment::Tenant.current, 'Enrollment', 'cache_program_steams']) do - program_ids = Enrollment.pluck(:program_stream_id).uniq + def self.cache_program_steams(type = 'Family') + Rails.cache.fetch([Apartment::Tenant.current, 'Enrollment', type, 'cache_program_steams']) do + program_ids = Enrollment.where(programmable_type: type).pluck(:program_stream_id).uniq ProgramStream.where(id: program_ids).order(:name).to_a end end @@ -89,6 +89,7 @@ def enrollment_date_value end def flash_cache - Rails.cache.delete([Apartment::Tenant.current, 'Enrollment', 'cache_program_steams']) + cache_keys = Rails.cache.instance_variable_get(:@data).keys.reject { |key| key[/#{Apartment::Tenant.current}\/.*cache_program_steams/].blank? } + cache_keys.each { |key| Rails.cache.delete(key) } end end