active_buddy 0.1.1 โ 0.2.0
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/README.md +17 -0
- data/lib/active_buddy/analyzer.rb +21 -0
- data/lib/active_buddy/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: c13cf857ccc9cf61976a9bf736223ae6c2b262c144f99317846c494e413c1419
|
4
|
+
data.tar.gz: 7fad1ff5832beaceb9167fb022b63c8cd19ddc0801fef94e3c14f82a9c3a0bd8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 674cbe6813cde3884aae361a5481bfd1ca3721f6a48e0093bdac5d9c148a7f404cb51835b8f5552981505fb82f001c3d2e170ade7a138de1e65ad504b32bbb42
|
7
|
+
data.tar.gz: bc4be7faf6ae6c04c6f9a90c904171afc2cdb90db853e671370b9fcf9f12b77cae0284c4420aa7347006a0ec11635675ce1d4e98b3ab0c73a838e1910b1f6be0
|
data/README.md
CHANGED
@@ -53,6 +53,7 @@ require 'active_Buddy'
|
|
53
53
|
analyzer = ActiveBuddy::Analyzer.new(User)
|
54
54
|
puts analyzer.suggest_validations
|
55
55
|
puts analyzer.suggest_associations
|
56
|
+
puts analyzer.quick_audit
|
56
57
|
```
|
57
58
|
|
58
59
|
Output:
|
@@ -84,6 +85,22 @@ ActiveBuddy automatically picks up and suggests validations based on:
|
|
84
85
|
|
85
86
|
Also detects and formats associations from ActiveRecord relationships.
|
86
87
|
|
88
|
+
|
89
|
+
๐ Auditing model: User
|
90
|
+
Fields detected: id, email, password, account_id, created_at, updated_at
|
91
|
+
|
92
|
+
โ
Suggested Validations:
|
93
|
+
validates :email, presence: true
|
94
|
+
validates :email, uniqueness: true
|
95
|
+
|
96
|
+
๐ Suggested Associations:
|
97
|
+
belongs_to :account
|
98
|
+
|
99
|
+
๐ก Tips:
|
100
|
+
- Consider adding presence validations for key fields.
|
101
|
+
- Add associations if your model connects to others (like belongs_to, has_many).
|
102
|
+
|
103
|
+
|
87
104
|
---
|
88
105
|
|
89
106
|
## ๐งช Run Specs
|
@@ -52,5 +52,26 @@ module ActiveBuddy
|
|
52
52
|
"#{assoc.macro} :#{assoc.name}"
|
53
53
|
end
|
54
54
|
end
|
55
|
+
|
56
|
+
def quick_audit
|
57
|
+
report = []
|
58
|
+
report << "๐ Auditing model: #{model.name}"
|
59
|
+
report << "Fields detected: #{model.columns.map(&:name).join(', ')}"
|
60
|
+
|
61
|
+
validations = suggest_validations
|
62
|
+
associations = suggest_associations
|
63
|
+
|
64
|
+
report << "\nโ
Suggested Validations:"
|
65
|
+
report += validations.empty? ? ["(none found)"] : validations
|
66
|
+
|
67
|
+
report << "\n๐ Suggested Associations:"
|
68
|
+
report += associations.empty? ? ["(none found)"] : associations
|
69
|
+
|
70
|
+
report << "\n๐ก Tips:"
|
71
|
+
report << "- Consider adding presence validations for key fields."
|
72
|
+
report << "- Add associations if your model connects to others (like belongs_to, has_many)."
|
73
|
+
report.join("\n")
|
74
|
+
end
|
75
|
+
|
55
76
|
end
|
56
77
|
end
|
data/lib/active_buddy/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_buddy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Your Name
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-04-
|
11
|
+
date: 2025-04-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|