Skip to content

add basic How it Works docs#2239

Merged
joelhawksley merged 8 commits intomainfrom
20250324-how-it-works
Mar 31, 2025
Merged

add basic How it Works docs#2239
joelhawksley merged 8 commits intomainfrom
20250324-how-it-works

Conversation

@joelhawksley
Copy link
Copy Markdown
Member

Closes #899

@joelhawksley joelhawksley force-pushed the 20250324-how-it-works branch from c290b11 to b13b6bf Compare March 25, 2025 22:33
Comment thread docs/how-it-works.md Outdated

### At component instantiation

ViewComponent does not perform any actions at component instantiation.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It might be worth calling out that the user provided initializer runs?

Copy link
Copy Markdown
Contributor

@khiga8 khiga8 left a comment

Choose a reason for hiding this comment

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

🚀

Comment thread docs/how-it-works.md

### At render

When a ViewComponent is passed to `render`, Rails calls `render_in`, passing the current [ActionView::Context](https://api.rubyonrails.org/classes/ActionView/Context.html). `ActionView::Context` is used to provide access to the current controller, request, and helpers, which is why they cannot be referenced until a component is rendered.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Aha!

@joelhawksley joelhawksley merged commit 68b7f7c into main Mar 31, 2025
23 checks passed
@joelhawksley joelhawksley deleted the 20250324-how-it-works branch March 31, 2025 16:44
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.

Add lifecycle diagram to documentation

3 participants