Skip to content

Commit

Permalink
Add nil check for report.extras on save hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
NickLaMuro committed Jun 19, 2018
1 parent 28dc337 commit 880f2ba
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 880f2ba

Please sign in to comment.