-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add documentation for component support #38656
Conversation
@@ -37,5 +37,5 @@ def self.compile | |||
end | |||
|
|||
private | |||
attr_reader :title, :view_context | |||
attr_reader :view_context | |||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we include this weighty thing in here even? Could we replace with something closer to Class.new { def render_in(view_context); "hey"; end }
?
@@ -277,6 +277,16 @@ since an attacker could use this action to access security sensitive files in yo | |||
|
|||
TIP: `send_file` is often a faster and better option if a layout isn't required. | |||
|
|||
#### Rendering view components |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Honestly don't think this is an apt description. The support is for any object that responds to render_in
, the fact that someone can implement components based on that is a side effect.
@@ -82,8 +82,9 @@ def initialize(controller, env, defaults) | |||
# need to call <tt>.to_json</tt> on the object you want to render. | |||
# * <tt>:body</tt> - Renders provided text and sets content type of <tt>text/plain</tt>. | |||
# | |||
# If no <tt>options</tt> hash is passed or if <tt>:update</tt> is specified, the default is | |||
# to render a partial and use the second parameter as the locals hash. | |||
# <tt>options</tt> hash is passed or if <tt>:update</tt> is specified, the default is to either call |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like If no
got lost. Think the wording is slightly clunky too. I think there's a version that we can write in half the length.
@kaspth this should be ready for another review. I couldn't get the copy to be half the length, but I feel like it's more clear 🙇 |
Sweet 🙌 |
Summary
This PR adds some basic documentation around the support for 3rd-party component libraries introduced in #36388 and #37919.
It also includes some minor cleanups of the example components in the test suite.