{"action":"opened","issue":{"url":"https://api.github.com/repos/apsislabs/phi_attrs/issues/2","repository_url":"https://api.github.com/repos/apsislabs/phi_attrs","labels_url":"https://api.github.com/repos/apsislabs/phi_attrs/issues/2/labels{/name}","comments_url":"https://api.github.com/repos/apsislabs/phi_attrs/issues/2/comments","events_url":"https://api.github.com/repos/apsislabs/phi_attrs/issues/2/events","html_url":"https://github.com/apsislabs/phi_attrs/issues/2","id":338379920,"node_id":"MDU6SXNzdWUzMzgzNzk5MjA=","number":2,"title":"Add shorthand for joined models","user":{"login":"wkirby","id":579688,"node_id":"MDQ6VXNlcjU3OTY4OA==","avatar_url":"https://avatars3.githubusercontent.com/u/579688?v=4","gravatar_id":"","url":"https://api.github.com/users/wkirby","html_url":"https://github.com/wkirby","followers_url":"https://api.github.com/users/wkirby/followers","following_url":"https://api.github.com/users/wkirby/following{/other_user}","gists_url":"https://api.github.com/users/wkirby/gists{/gist_id}","starred_url":"https://api.github.com/users/wkirby/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wkirby/subscriptions","organizations_url":"https://api.github.com/users/wkirby/orgs","repos_url":"https://api.github.com/users/wkirby/repos","events_url":"https://api.github.com/users/wkirby/events{/privacy}","received_events_url":"https://api.github.com/users/wkirby/received_events","type":"User","site_admin":false},"labels":[{"id":934416618,"node_id":"MDU6TGFiZWw5MzQ0MTY2MTg=","url":"https://api.github.com/repos/apsislabs/phi_attrs/labels/enhancement","name":"enhancement","color":"a2eeef","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-07-04T21:45:13Z","updated_at":"2018-07-04T21:45:13Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"When dealing with a `phi_model` it's not that infrequent that we'll have _joined_ `phi_models`. For convenience, we should have a shorthand method of extending `allow_phi!` to include those joins.\r\n\r\nThere should be two methods of doing this. One at the class level, which essentially acts as a permanent extension: allowing PHI access on this model will grant PHI access on these models. I'm thinking a syntax like:\r\n\r\n```ruby\r\nclass PatientInfo < ActiveRecord::Base\r\n  phi_model\r\nend\r\n\r\nclass Patient < ActiveRecord::Base\r\n  has_one :patient_info\r\n\r\n  phi_model\r\n  extend_phi_access :patient_info\r\nend\r\n\r\npatient = Patient.new\r\npatient.allow_phi!('user@example.com', 'reason')\r\npatient.patient_info.first_name\r\n```\r\n\r\nAdditionally, there should be a per-usage shorthand. Something that is passed as an argument to `allow_phi!`. I'm thinking something like:\r\n\r\n```ruby\r\nclass PatientInfo < ActiveRecord::Base\r\n  phi_model\r\nend\r\n\r\nclass Patient < ActiveRecord::Base\r\n  has_one :patient_info\r\n\r\n  phi_model\r\nend\r\n\r\npatient = Patient.new\r\npatient.allow_phi!('user@example.com', 'reason', include: [:patient_info])\r\npatient.patient_info.first_name\r\n```"}}
{"actor":{"display_login":"wkirby"}}