Open wkirby opened 2 years ago
# model with associations class Foo < ActiveRecord::Base phi_model belongs_to :bar has_many :baz extend_phi_access :bar, :baz end # setup associations foo = Foo.new bar = Bar.new baz = Baz.new foo.bar = bar foo.baz << baz # PHI access is not extended until we call the wrapped method foo.allow_phi!('me', 'reason') foo.association(:bar).reader.phi_allowed? # => false foo.bar.phi_allowed? # => true foo.association(:bar).reader.phi_allowed? # => true # desired outcome foo.allow_phi!('me', 'reason') foo.association(:bar).reader.phi_allowed? # => true foo.bar.phi_allowed? # => true foo.association(:bar).reader.phi_allowed? # => true
We should update allow_phi! to proactively iterate over PHI extensions and call allow PHI on them.
allow_phi!
We should update
allow_phi!
to proactively iterate over PHI extensions and call allow PHI on them.