attribeauty 0.4.5 → 0.4.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/Gemfile.lock +1 -1
- data/lib/attribeauty/params.rb +14 -0
- data/lib/attribeauty/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e043b4e5f8fcbdfd096c6cd5deabfca25667b5c0e3a2754b8106f250e12569cd
|
|
4
|
+
data.tar.gz: 450ccb28494f3b5dbde4d3f56113997bf5d3e85dfb6fee82a1f683ca85e7523e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a44271c47fdec0e64fcfa8bae79b426d88a67b3c5eae25201c7ce675f1b9188308dfb5c13df908c3701bef1f7350bf786becf0d395b6ff5ce918d2706f4a6bed
|
|
7
|
+
data.tar.gz: '048046380ad6ac7c65b7406beeb222ee553beea2bed15ea2b855dfdac4b19243537046caeb579d21eb3d536b3e758323f38e6cfb0cbec8d8fea90284331aca00'
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
## [Unreleased]
|
|
2
2
|
|
|
3
|
+
## [0.4.6] - 2024-06-28
|
|
4
|
+
|
|
5
|
+
- unofficial support for auto generating rails models params filtering
|
|
6
|
+
- no tests, and simply a script I'm using in an app to do the same
|
|
7
|
+
|
|
3
8
|
## [0.4.5] - 2024-06-27
|
|
4
9
|
|
|
5
10
|
- using `root` instead of `container`, this is what serializers use
|
data/Gemfile.lock
CHANGED
data/lib/attribeauty/params.rb
CHANGED
|
@@ -68,6 +68,20 @@ module Attribeauty
|
|
|
68
68
|
strict
|
|
69
69
|
end
|
|
70
70
|
|
|
71
|
+
def generate_for(model, *columns)
|
|
72
|
+
raise "Method requires Rails" unless defined?(Rails)
|
|
73
|
+
|
|
74
|
+
root_node = model.to_s.downcase.to_sym
|
|
75
|
+
cols = columns.map(&:to_s)
|
|
76
|
+
root root_node do
|
|
77
|
+
model.columns_hash.slice(*cols).each_value do |table|
|
|
78
|
+
attrs = table.name.to_sym, table.type
|
|
79
|
+
attrs << { exclude_if: :nil? } if table.null == false
|
|
80
|
+
attribute(*attrs)
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
|
|
71
85
|
private
|
|
72
86
|
|
|
73
87
|
def value_from_validator(name, value, type, **args)
|
data/lib/attribeauty/version.rb
CHANGED