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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 374ded7327851e372722c4b501033f42dff9d55d9c0f2c2c1f76b897a12684dd
4
- data.tar.gz: 7f3ad264240f23741939149d3d6583ddcf2087fa5c6482665b0e31992177b108
3
+ metadata.gz: e043b4e5f8fcbdfd096c6cd5deabfca25667b5c0e3a2754b8106f250e12569cd
4
+ data.tar.gz: 450ccb28494f3b5dbde4d3f56113997bf5d3e85dfb6fee82a1f683ca85e7523e
5
5
  SHA512:
6
- metadata.gz: 5905f649b65f1b9056459a9da1c499130c2aac5e4f5aa62185d1c3d6b610832ed89317930b0036b2f243f653ce867d9823b382e9880124e526012e1271087e73
7
- data.tar.gz: 6d42d7c5cd9cfec6313d832892289ddc87b75dbb07f2d636addb5b7a2a64e3579ede93ba7080b07f5dbdacbccc489dd31e66df4a5c186cfcb8c00aa8302b960b
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
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- attribeauty (0.4.5)
4
+ attribeauty (0.4.6)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -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)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Attribeauty
4
- VERSION = "0.4.5"
4
+ VERSION = "0.4.6"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: attribeauty
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.5
4
+ version: 0.4.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Toby