Skip to content

Commit

Permalink
Fix hook errors when application has a mounted engine named Admin
Browse files Browse the repository at this point in the history
  • Loading branch information
spohlenz committed May 22, 2024
1 parent 64fe650 commit 6e95cb6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion app/helpers/trestle/navigation_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ def current_navigation_item?(item)
end

def current_admin?(admin)
respond_to?(:admin) && self.admin && self.admin.name == admin.name
respond_to?(:admin) &&
self.admin.respond_to?(:name) &&
self.admin.name == admin.name
end

def navigation_group_collapsed?(group)
Expand Down
2 changes: 1 addition & 1 deletion lib/trestle/hook/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def hooks(name)

def hook_sets
@_hook_sets ||= [
(admin.hooks if defined?(admin) && admin),
(admin.hooks if defined?(admin) && admin.respond_to?(:hooks)),
Trestle.config.hooks
].compact
end
Expand Down

0 comments on commit 6e95cb6

Please sign in to comment.