Skip to content

Commit

Permalink
Add associations to end product establishment for effectuations (#15170)
Browse files Browse the repository at this point in the history
### Description
PR to take advantage of rails associations to be able to access board grant effectuations easily on a board grant effectuation end product establishment.
  • Loading branch information
leikkisa committed Sep 15, 2020
1 parent 80ff748 commit 7ee8dd8
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions app/models/end_product_establishment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
class EndProductEstablishment < CaseflowRecord
belongs_to :source, polymorphic: true
belongs_to :user
has_many :request_issues
has_many :end_product_code_updates
has_many :effectuations, class_name: "BoardGrantEffectuation"

# allow @veteran to be assigned to save upstream calls
attr_writer :veteran
Expand Down Expand Up @@ -279,12 +281,6 @@ def generate_tracked_item!
end
end

def request_issues
return RequestIssue.none unless source.try(:request_issues)

source.request_issues.where(end_product_establishment_id: id)
end

def associated_rating_cache_key
"end_product_establishments/#{id}/associated_rating"
end
Expand Down

0 comments on commit 7ee8dd8

Please sign in to comment.