propel_facets 0.2.0 → 0.2.1
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8764980d8f96e30b33af48655e5f663f462c2a163d414d0dd55122b069454bb8
|
4
|
+
data.tar.gz: 8c1169ffe3ffbbe48fff25ef54c26ffe2a2fd81c1c63257bac4eeda9992497d3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8312227990dd32b4026485fd9e331fea3504019342741511214a33754b8e8c67cbe4ce25817fb4f4d319dcf1e4a4e25e305eab590c96a6a8f860d64343021a8c
|
7
|
+
data.tar.gz: 4a8184cff3c9bf000f2b42e71cc7d2fb8f6c00c5b7f6c03a9035eba1079d2820cca44e9518dc86000994b4d475b4dc10d2ddefad3c89e715026889cd1d2f8fd4
|
data/CHANGELOG.md
CHANGED
@@ -14,6 +14,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
14
14
|
- Metadata inclusion (pagination, counts, etc.)
|
15
15
|
- Performance logging and optimization tools
|
16
16
|
|
17
|
+
## [0.2.1] - 2025-01-14
|
18
|
+
|
19
|
+
### Fixed
|
20
|
+
- **Critical generator bug**: Fixed missing `for_organization` scope in ApplicationRecord installation
|
21
|
+
- Install generator now properly adds `for_organization` scope when ApplicationRecord already exists
|
22
|
+
- Previously only added ModelFacet includes but not the multi-tenancy scope required by PropelApi controllers
|
23
|
+
- Enhanced scope implementation to handle both Organization objects and integer IDs
|
24
|
+
- Resolves `NoMethodError: undefined method 'for_organization' for Model:Class` in fresh Rails installations
|
25
|
+
- Updated both injection method and template files for consistency
|
26
|
+
|
17
27
|
## [0.2.0] - 2025-09-02
|
18
28
|
|
19
29
|
### Added
|
@@ -92,6 +92,18 @@ module PropelFacets
|
|
92
92
|
json_facet :short, base: :included, include_as: :reference
|
93
93
|
json_facet :details, base: :short, include_as: :included
|
94
94
|
|
95
|
+
# Organization scoping for multi-tenancy
|
96
|
+
scope :for_organization, ->(organization_or_id) {
|
97
|
+
case organization_or_id
|
98
|
+
when nil
|
99
|
+
none # No organization = no access
|
100
|
+
when Organization
|
101
|
+
where(organization: organization_or_id)
|
102
|
+
else
|
103
|
+
where(organization_id: organization_or_id)
|
104
|
+
end
|
105
|
+
}
|
106
|
+
|
95
107
|
RUBY
|
96
108
|
end
|
97
109
|
end
|
@@ -12,8 +12,14 @@ class ApplicationRecord < ActiveRecord::Base
|
|
12
12
|
json_facet :details, base: :short, include_as: :included
|
13
13
|
|
14
14
|
# Organization scoping for multi-tenancy
|
15
|
-
scope :for_organization, ->(
|
16
|
-
|
17
|
-
|
15
|
+
scope :for_organization, ->(organization_or_id) {
|
16
|
+
case organization_or_id
|
17
|
+
when nil
|
18
|
+
none # No organization = no access
|
19
|
+
when Organization
|
20
|
+
where(organization: organization_or_id)
|
21
|
+
else
|
22
|
+
where(organization_id: organization_or_id)
|
23
|
+
end
|
18
24
|
}
|
19
25
|
end
|
data/lib/propel_facets.rb
CHANGED