propel_facets 0.2.0 → 0.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e5233eaef1c8dc1acd2c631b9117c5b1a13c8deb1997d97a0e5fb294c7c55081
4
- data.tar.gz: 15905b8628b5f2cb805b91ba4e25b36451a23ece1768216f64b0ae4fe964a96e
3
+ metadata.gz: cb36b130305f2d389595638d55e49505c299f0c097631f43536d92d492164a94
4
+ data.tar.gz: 669d26423c4646c148e3f1a38dc9353546b14367d99fd715e20fff7a14d22fea
5
5
  SHA512:
6
- metadata.gz: 57cf3b84754b71e1c18d45ac31690531ec212f49bc2179eda78fc3e791b01f0e6cf7c2dbf38f99e42765c45dfd1a39b071446a461ceb88a206339f2303a7ac82
7
- data.tar.gz: 461b058e8e4f91e575d83560029b738f873c8dd85744be9c22e1bfd343a8c07b53cf1035229ea0906125c8710c20995c51e4f3c4ed568b408f047e2ca816b6e7
6
+ metadata.gz: 31dce29ff749d1dab2a461012d1fb8201487121f4bc1af95780c111a8de6409aedc108950fbfcfcd692b227f926418bec2a651c60dfe16738fe40a027081fb7d
7
+ data.tar.gz: 32ca6acf81cfea562b12c704e4cb46b14207dd74f56560b58785033aa079cbf58dc3f647e24ce620ef7f4b2eee31f9bb267734f3e30c5504bc432ee191d86d71
data/CHANGELOG.md CHANGED
@@ -14,6 +14,27 @@ 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.3.0] - 2025-01-15
18
+
19
+ ### 🔧 Compatibility Updates
20
+ - **PropelApi Integration**: Updated to work seamlessly with PropelApi 0.3.0's new polymorphic association features
21
+ - **Polymorphic Facet Support**: Enhanced JSON facet generation for polymorphic associations
22
+ - **Template Compatibility**: All facet templates now compatible with enhanced polymorphic test generation
23
+
24
+ ### ✨ Enhancements
25
+ - **Polymorphic Include Support**: Facets now properly handle `include: [:polymorphic_association]` with correct type information
26
+ - **Association Serialization**: Improved handling of polymorphic associations in JSON responses
27
+
28
+ ## [0.2.1] - 2025-01-14
29
+
30
+ ### Fixed
31
+ - **Critical generator bug**: Fixed missing `for_organization` scope in ApplicationRecord installation
32
+ - Install generator now properly adds `for_organization` scope when ApplicationRecord already exists
33
+ - Previously only added ModelFacet includes but not the multi-tenancy scope required by PropelApi controllers
34
+ - Enhanced scope implementation to handle both Organization objects and integer IDs
35
+ - Resolves `NoMethodError: undefined method 'for_organization' for Model:Class` in fresh Rails installations
36
+ - Updated both injection method and template files for consistency
37
+
17
38
  ## [0.2.0] - 2025-09-02
18
39
 
19
40
  ### 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, ->(organization_id) {
16
- return none if organization_id.blank?
17
- where(organization_id: organization_id)
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
@@ -1,3 +1,3 @@
1
1
  module PropelFacets
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: propel_facets
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Propel Team
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-09-02 00:00:00.000000000 Z
11
+ date: 2025-09-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails