Skip to content

Commit

Permalink
update docs around rendering in controllers (#1404)
Browse files Browse the repository at this point in the history
* update docs around rendering in controllers
see #1322

* vale

* grammar

* Update docs/guide/getting-started.md

Co-authored-by: Simon Fish <si@mon.fish>

Co-authored-by: Simon Fish <si@mon.fish>
  • Loading branch information
joelhawksley and boardfish authored Jul 5, 2022
1 parent 53b8121 commit 3821267
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
7 changes: 7 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ title: Changelog

## main

* Update docs to reflect lack of block content support in controllers.

*Joel Hawksley*

* Prevent adding duplicates to `autoload_paths`.

*Thomas Hutterer*
Expand All @@ -18,6 +22,9 @@ title: Changelog
*Simon Fish*

* Include polymorphic slots in `ViewComponent::Base` by default.

*Cameron Dutro*

* Add per-component config option for stripping newlines from templates before compilation.

*Cameron Dutro*
Expand Down
4 changes: 2 additions & 2 deletions docs/guide/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,11 @@ It's also possible to render ViewComponents in controllers:
```ruby
# app/controllers/home_controller.rb
def show
render(ExampleComponent.new(title: "My Title")) { "Hello, World!" }
render(ExampleComponent.new(title: "My Title"))
end
```

_In versions of Rails < 6.1, rendering a ViewComponent from a controller doesn't include the layout._
_Note: Content can't be passed to a component via a block in controllers. Instead, use `with_content`. In versions of Rails < 6.1, rendering a ViewComponent from a controller doesn't include the layout._

### Rendering ViewComponents to strings inside controller actions

Expand Down

0 comments on commit 3821267

Please sign in to comment.