view_component 2.64.0 → 2.65.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of view_component might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/docs/CHANGELOG.md +15 -0
- data/lib/view_component/slotable_v2.rb +3 -2
- data/lib/view_component/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: db3da8b9e69982d34a963e91a36a872b8c09a83526b142e51c0cf9548c0d704e
|
4
|
+
data.tar.gz: 305ea910ad67535dd4769d3c570bb11a3ef37aea09118174b0861ec7089ee234
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 842babf3fd5a9c1e15c803e2605e6e4891b08c0766948f1e5a0e72bdaaf0b129a8b26959684adb8be257d295681ef241e3c828651a72e1badda342382cfca662
|
7
|
+
data.tar.gz: 920553b0b73da80802fb940821fb454cf7587063d7df89630f4fb9425c123b38cfc5e3e49b912022a556a8207f6ca8e6e47662d86056dbf603c548eb9197dee2
|
data/docs/CHANGELOG.md
CHANGED
@@ -9,6 +9,21 @@ title: Changelog
|
|
9
9
|
|
10
10
|
## main
|
11
11
|
|
12
|
+
## 2.65.0
|
13
|
+
|
14
|
+
* Raise `ArgumentError` when conflicting Slots are defined.
|
15
|
+
|
16
|
+
Before this change it was possible to define Slots with conflicting names, for example:
|
17
|
+
|
18
|
+
```ruby
|
19
|
+
class MyComponent < ViewComponent::Base
|
20
|
+
renders_one :item
|
21
|
+
renders_many :items
|
22
|
+
end
|
23
|
+
```
|
24
|
+
|
25
|
+
*Joel Hawksley*
|
26
|
+
|
12
27
|
## 2.64.0
|
13
28
|
|
14
29
|
* Add `warn_on_deprecated_slot_setter` flag to opt-in to deprecation warning.
|
@@ -80,6 +80,7 @@ module ViewComponent
|
|
80
80
|
# <% end %>
|
81
81
|
def renders_one(slot_name, callable = nil)
|
82
82
|
validate_singular_slot_name(slot_name)
|
83
|
+
validate_plural_slot_name(ActiveSupport::Inflector.pluralize(slot_name).to_sym)
|
83
84
|
|
84
85
|
define_method :"with_#{slot_name}" do |*args, &block|
|
85
86
|
set_slot(slot_name, nil, *args, &block)
|
@@ -147,9 +148,9 @@ module ViewComponent
|
|
147
148
|
# <% end %>
|
148
149
|
# <% end %>
|
149
150
|
def renders_many(slot_name, callable = nil)
|
150
|
-
validate_plural_slot_name(slot_name)
|
151
|
-
|
152
151
|
singular_name = ActiveSupport::Inflector.singularize(slot_name)
|
152
|
+
validate_plural_slot_name(slot_name)
|
153
|
+
validate_singular_slot_name(ActiveSupport::Inflector.singularize(slot_name).to_sym)
|
153
154
|
|
154
155
|
# Define setter for singular names
|
155
156
|
# for example `renders_many :items` allows fetching all tabs with
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: view_component
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.65.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GitHub Open Source
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-08-
|
11
|
+
date: 2022-08-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|