Skip to content

Commit

Permalink
Merge pull request #17605 from NickLaMuro/fix_specs_and_issues_from_m…
Browse files Browse the repository at this point in the history
…iq_report_result_save_hooks

Add `nil` check for report.extras on save hooks
(cherry picked from commit 8a6adec)

https://bugzilla.redhat.com/show_bug.cgi?id=1594387
  • Loading branch information
jrafanie authored and simaishi committed Jun 22, 2018
1 parent 49df80e commit 44dd61a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/models/miq_report_result.rb
Expand Up @@ -46,8 +46,8 @@ class MiqReportResult < ApplicationRecord
# the remainder of the object's instantiation. The `after_commit` hook
# specifically is probably overkill, but allows us to not break existing code
# that expects the temporary chargeback data in the instantiated object.
before_save { @_extra_groupings = report.extras.delete(:grouping) if report.kind_of?(MiqReport) }
after_commit { report.extras[:grouping] = @_extra_groupings if report.kind_of?(MiqReport) }
before_save { @_extra_groupings = report.extras.delete(:grouping) if report.kind_of?(MiqReport) && report.extras }
after_commit { report.extras[:grouping] = @_extra_groupings if report.kind_of?(MiqReport) && report.extras }

delegate :table, :to => :report_results, :allow_nil => true

Expand Down

0 comments on commit 44dd61a

Please sign in to comment.