Created
April 15, 2018 13:36
-
-
Save rafbm/a6c331ceb79fcfc2cd58b83fc1778b3f to your computer and use it in GitHub Desktop.
Revisions
-
rafbm created this gist
Apr 15, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,20 @@ def call scope = base_relation.joins(:care_periods) if params.care_provider_id.present? scope = scope .where(care_periods: { care_provider_id: params.care_provider_id }) end if params.hospital_id.present? scope = scope .where(care_periods: { hospital_id: params.hospital_id }) end if params.discharge_period.present? scope = scope.joins(:hospital_visit) .where(hospital_visits: { end_on: params.discharge_period } end scope end