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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate Base#with_variant #1041

Merged
merged 4 commits into from
Aug 17, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ title: Changelog

*Blake Williams*, *Cameron Dutro*, *Joel Hawksley*

* Deprecate `Base#with_variant`.

*Cameron Dutro*

## 2.38.0

* Add `--stimulus` flag to the component generator. Generates a Stimulus controller alongside the component.
Expand Down
5 changes: 5 additions & 0 deletions lib/view_component/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,14 @@ def format

# Use the provided variant instead of the one determined by the current request.
#
# @deprecated Define separate per-variant templates instead. Will be removed in v3.0.0.
joelhawksley marked this conversation as resolved.
Show resolved Hide resolved
# @param variant [Symbol] The variant to be used by the component.
# @return [self]
def with_variant(variant)
ActiveSupport::Deprecation.warn(
"`with_variant` is deprecated and will be removed in ViewComponent v3.0.0."
)

@__vc_variant = variant

self
Expand Down