Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trick RDoc to pickup ActiveRecord::Core#values_at #48324

Merged
merged 1 commit into from
May 29, 2023

Conversation

zzak
Copy link
Member

@zzak zzak commented May 29, 2023

Before

Screenshot 2023-05-29 at 10 40 44

(Notice the missing "V" methods)

After

Screenshot 2023-05-29 at 10 40 25

First, this came from #44544, something I found surprising was that these are the only methods documented on ActiveModel::Model. But my guess is that because the other methods are available by include, it makes sense to document them there -- while ActiveModel::Access is private?

/cc @jonathanhefner


Second, I do not know why swapping the order here works. I've tried inspecting RDoc internals and using debug mode, but there was no apparent reason why the method was being dropped. Meanwhile, the same order works fine for ActiveModel::Model. 馃し

@zzak zzak merged commit 7496cfe into rails:main May 29, 2023
8 of 9 checks passed
@zzak zzak deleted the ar-core-values_at branch May 29, 2023 01:56
jonathanhefner added a commit that referenced this pull request Oct 7, 2023
When a `:method:` doc is immediately followed by the `private` keyword,
RDoc will hide that doc as if it were a private method.

In #48324, the `:method:` docs for `ActiveRecord::Core#slice` and
`ActiveRecord::Core#values_at` were swapped in an attempt to force
`values_at` to appear in the rendered docs.  However, doing so causes
`slice` to dissappear from the rendered docs.

To ensure that `slice` and `values_at` both appear in the rendered docs,
this commit moves their `:method:` docs away from the `private` keyword
in `ActiveRecord::Core`.
@jonathanhefner
Copy link
Member

jonathanhefner commented Oct 7, 2023

It turns out the problem is the private keyword. When a :method: doc is immediately followed by the private keyword, RDoc will hide that doc as if it were a private method. So this PR makes values_at appear, but makes slice dissappear. 馃檭 I've fixed the issue in c8b3642.

I also grepped for similar occurrences and found MessageEncryptors#on_rotation and MessageVerifiers#on_rotation, which I fixed in 4726b1a.

jonathanhefner added a commit that referenced this pull request Oct 7, 2023
When a `:method:` doc is immediately followed by the `private` keyword,
RDoc will hide that doc as if it were a private method.

In #48324, the `:method:` docs for `ActiveRecord::Core#slice` and
`ActiveRecord::Core#values_at` were swapped in an attempt to force
`values_at` to appear in the rendered docs.  However, doing so causes
`slice` to dissappear from the rendered docs.

To ensure that `slice` and `values_at` both appear in the rendered docs,
this commit moves their `:method:` docs away from the `private` keyword
in `ActiveRecord::Core`.

(cherry picked from commit c8b3642)
@zzak
Copy link
Member Author

zzak commented Oct 8, 2023

@jonathanhefner Nice work, and thanks for following up!

I've filed a bug with Ruby:
https://bugs.ruby-lang.org/issues/19914

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants