Skip to content

Commit

Permalink
Deprecate Base#with_variant (#1041)
Browse files Browse the repository at this point in the history
  • Loading branch information
camertron authored Aug 17, 2021
1 parent b1f7634 commit 0fd7cbf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
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 Will be removed in v3.0.0.
# @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

0 comments on commit 0fd7cbf

Please sign in to comment.