Skip to content

Commit

Permalink
Add parent class name to additional options for report data
Browse files Browse the repository at this point in the history
  • Loading branch information
karelhala committed Nov 7, 2017
1 parent 8f2b93a commit 65f795d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
Expand Up @@ -5,6 +5,7 @@ class ApplicationController
:model,
:match_via_descendants,
:parent_id,
:parent_class_name,
:parent_method,
:association,
:view_suffix
Expand All @@ -16,6 +17,7 @@ def self.from_options(options)
additional_options.with_model(options[:model]) if options[:model]
additional_options.match_via_descendants = options[:match_via_descendants]
additional_options.parent_id = options[:parent].id if options[:parent]
additional_options.parent_class_name = options[:parent].class.name if options[:parent]
additional_options.association = options[:association]
additional_options.view_suffix = options[:view_suffix]
additional_options.parent_method = options[:parent_method]
Expand Down
4 changes: 4 additions & 0 deletions app/helpers/application_helper.rb
Expand Up @@ -1639,6 +1639,10 @@ def from_additional_options(additional_options)
if additional_options[:match_via_descendants].present?
additional_options[:match_via_descendants] = additional_options[:match_via_descendants].constantize
end
if additional_options[:parent_id].present? && additional_options[:parent_class_name].present?
parent_id = from_cid(additional_options[:parent_id])
additional_options[:parent] = additional_options[:parent_class_name].constantize.find(parent_id)
end
additional_options
end

Expand Down

0 comments on commit 65f795d

Please sign in to comment.