Created
August 19, 2016 19:58
-
-
Save kstevens715/97f00bab895b3d3bf25c94d86df74709 to your computer and use it in GitHub Desktop.
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 characters
| class UserIdentity | |
| def cas_attachments | |
| sql = id_column.in(cas_attachment_belongs_to_my_cas).or(id_column.in(cas_attachment_belongs_to_my_programs)) | |
| CasAttachment.where(sql) | |
| end | |
| def table | |
| CasAttachment.arel_table | |
| end | |
| def cas_attachment_belongs_to_my_cas | |
| CasAttachment.for_cas(cas).select(:id).ast | |
| end | |
| def cas_attachment_belongs_to_my_programs | |
| CasAttachment.for_program(programs.select(:id)).select(:id).ast | |
| end | |
| def id_column | |
| table[:id] | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment