Skip to content

Expose current_resource_owner as a view helper#1815

Merged
nbulaj merged 1 commit into
doorkeeper-gem:mainfrom
55728:expose-current-resource-owner-to-views
Apr 20, 2026
Merged

Expose current_resource_owner as a view helper#1815
nbulaj merged 1 commit into
doorkeeper-gem:mainfrom
55728:expose-current-resource-owner-to-views

Conversation

@55728

@55728 55728 commented Apr 15, 2026

Copy link
Copy Markdown
Contributor

Summary

Exposes current_resource_owner as a view helper, following the pattern used by Devise for current_user.

Previously, custom views needing access to the resource owner had to rely on the undocumented @current_resource_owner memoized instance variable. This PR makes the helper officially available in views.

Closes #1674.

Changes

  • Register current_resource_owner via helper_method in Doorkeeper::Helpers::Controller's included hook, guarded by respond_to?(:helper_method) so ApplicationMetalController is unaffected
  • Add specs covering helper registration and end-to-end view rendering
  • Add a regression test ensuring the metal controller stays view-helper-free
  • Update CHANGELOG

Notes

Picking this up since the original reporter hasn't had a chance to open a PR.

cc @nbulaj — following your suggestion in the issue thread 🙌

Previously custom views had to rely on the undocumented
@current_resource_owner memoized ivar to read the resource owner.
Register current_resource_owner via helper_method on controllers
that support it (non-metal), mirroring Devise's current_user pattern.

Closes #1674.
@nbulaj nbulaj added this to the 5.9.1 milestone Apr 16, 2026

@nbulaj nbulaj left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, LGTM 👍

@nbulaj nbulaj merged commit b7def19 into doorkeeper-gem:main Apr 20, 2026
22 checks passed
@55728 55728 deleted the expose-current-resource-owner-to-views branch April 20, 2026 21:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enhancement: expose current_resource_owner to views

2 participants