organizations 0.3.0 → 0.3.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: 9182741872f9485ca52d426a687201fc785e5959a79fa3e4acd6b8af6e0fa9e5
4
- data.tar.gz: 4836859405283c87543e3470e4d3cfeaf543096c76bf2589efed04099ea5112d
3
+ metadata.gz: 93641d7c8f80e347c31ffb9ad1c1f0f489078218f65c8204a4f3f48ad1d3c070
4
+ data.tar.gz: 79f97cdfe624459b128075e7800d1452b35be970109cb7b1e2c040fcc69694b0
5
5
  SHA512:
6
- metadata.gz: eedcce955043e1aa3bd6c0a10ed0ecc8d61d89f004176c90df5c048badbc5e8f8db6d473eeb863bdb5e0716a0b66cd543cacd7f9f8ce588e9a2702992b7b56ff
7
- data.tar.gz: ff8cc67de84d9e9964d1888ea8404d3d10f80c271240551c1d4b8a77d3c0e3da199abdcc5c779e793d400197fc3b2c987b19a2410146b9f07c106942846c454d
6
+ metadata.gz: b60315a1184fe81064acb974a95dd80a82c99abf9fbedb117a231e43a44ec11b99218b25f38efeae6ad88015b7445e66354a2351c28ad3572f75dd7323e60601
7
+ data.tar.gz: 5d0618750b4a4e59757538a99e1ca3e8ae6817f7cf6a395e194e7754eabc1f43dd747ea37e3aacf6979b0b5c945336b226c6e18e915a3dae58b14bbe13c3c1a5
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## [0.3.1] - 2026-02-28
2
+
3
+ - Fixed `organization_switcher_data[:switch_path]` generating broken URLs when engine mounted with custom name (e.g., `as: 'organizations_engine'`)
4
+ - `switch_path` now uses engine's own route helpers, works regardless of mount name or path
5
+
1
6
  ## [0.3.0] - 2026-02-20
2
7
 
3
8
  - Invitation onboarding is now first-class and configurable, so host apps can remove most custom signup/invite glue code.
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Organizations
4
- VERSION = "0.3.0"
4
+ VERSION = "0.3.1"
5
5
  end
@@ -326,16 +326,21 @@ module Organizations
326
326
  end
327
327
 
328
328
  # Build a lambda for generating switch paths
329
- # Uses route helpers when available, falls back to hardcoded path
329
+ # Uses the engine's own route helpers to ensure correct paths regardless of mount configuration
330
330
  def build_switch_path_lambda
331
- # Try to use route helpers if available
332
- # The route name is :switch_organization (POST /organizations/switch/:id)
333
- if respond_to?(:organizations) && organizations.respond_to?(:switch_organization_path)
331
+ # Primary: Use the engine's own route helpers
332
+ # This works regardless of how the engine is mounted (name or path).
333
+ # When mounted (e.g., `mount Engine => '/org'`), the engine's url_helpers
334
+ # generate paths relative to the mount point (e.g., `/org/organizations/switch/:id`).
335
+ if defined?(Organizations::Engine)
336
+ ->(org_id) { Organizations::Engine.routes.url_helpers.switch_organization_path(org_id) }
337
+ # Fallbacks below are for non-Rails environments (e.g., gem unit tests that don't load Rails).
338
+ # In production Rails apps, Organizations::Engine is always defined.
339
+ elsif respond_to?(:organizations) && organizations.respond_to?(:switch_organization_path)
334
340
  ->(org_id) { organizations.switch_organization_path(org_id) }
335
341
  elsif respond_to?(:main_app) && main_app.respond_to?(:switch_organization_path)
336
342
  ->(org_id) { main_app.switch_organization_path(org_id) }
337
343
  else
338
- # Fallback to standard path
339
344
  ->(org_id) { "/organizations/switch/#{org_id}" }
340
345
  end
341
346
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: organizations
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - rameerez
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2026-02-21 00:00:00.000000000 Z
10
+ date: 2026-02-28 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: railties