plutonium 0.57.0 → 0.58.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/CHANGELOG.md +8 -0
- data/lib/generators/pu/rodauth/templates/config/initializers/url_options.rb +7 -13
- data/lib/plutonium/interaction/base.rb +7 -9
- data/lib/plutonium/invites/concerns/invite_token.rb +1 -1
- data/lib/plutonium/resource/controller.rb +15 -0
- data/lib/plutonium/resource/controllers/interactive_actions.rb +11 -0
- data/lib/plutonium/version.rb +1 -1
- data/package.json +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: 0dbc2397e69b01d4570b44352873ed678884596e42fb6e9187d73c757ef12cb5
|
|
4
|
+
data.tar.gz: '049b9ee55a141c38c0544de18a2a39ed02e22d56aeb3f6076fdff4938bb1eff4'
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b47bf5a27f2a89a4ea705baf78cb34bd17bdb9270bdd386e5d0fa30e601744632945ca451ba019ad4788626702d667a67b848306c4fcc38d29ebd70bbbbc9c12
|
|
7
|
+
data.tar.gz: 02ee1e16fe6fc058f14295a54d2a5db2e52c9a65f2d26d5ab988a1b9bdb379c7d1eb32d2b1cc24482c1bae19628e0629bc5a536d64865a893d7b2291ab0e1389
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
## [0.58.0] - 2026-06-10
|
|
2
|
+
|
|
3
|
+
### 🐛 Bug Fixes
|
|
4
|
+
|
|
5
|
+
- *(rodauth)* Set url_options directly on ActionMailer::Base instead of config
|
|
6
|
+
- *(interaction)* Short-circuit call with failure when validation fails
|
|
7
|
+
- *(form)* Pre-populate extraction record so conditioned selects resolve correctly
|
|
8
|
+
- *(invites)* Use after_commit to avoid orphaned email jobs on rollback
|
|
1
9
|
## [0.57.0] - 2026-06-09
|
|
2
10
|
|
|
3
11
|
### 🚀 Features
|
|
@@ -1,17 +1,11 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
host: uri.host,
|
|
9
|
-
port: uri.port,
|
|
10
|
-
protocol: uri.scheme
|
|
11
|
-
}
|
|
12
|
-
end
|
|
3
|
+
if (default_url = ENV["RAILS_DEFAULT_URL"])
|
|
4
|
+
uri = URI.parse(default_url)
|
|
5
|
+
default_port = (uri.scheme == "https") ? 443 : 80
|
|
6
|
+
url_options = {host: uri.host, protocol: uri.scheme}
|
|
7
|
+
.tap { |opts| opts[:port] = uri.port if uri.port != default_port }
|
|
13
8
|
|
|
14
|
-
if
|
|
15
|
-
|
|
16
|
-
end
|
|
9
|
+
ActionMailer::Base.default_url_options = url_options if ActionMailer::Base.default_url_options.blank?
|
|
10
|
+
Rails.application.routes.default_url_options = url_options if Rails.application.routes.default_url_options.blank?
|
|
17
11
|
end
|
|
@@ -70,16 +70,14 @@ module Plutonium
|
|
|
70
70
|
#
|
|
71
71
|
# @return [Plutonium::Interaction::Outcome] The result of the interaction.
|
|
72
72
|
def call
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
outcome
|
|
80
|
-
else
|
|
81
|
-
failure.with_message("An error occurred")
|
|
73
|
+
return failure unless valid?
|
|
74
|
+
|
|
75
|
+
outcome = execute
|
|
76
|
+
unless outcome.is_a?(Plutonium::Interaction::Outcome)
|
|
77
|
+
raise "#{self.class}#execute must return an instance of Plutonium::Interaction::Outcome.\n" \
|
|
78
|
+
"#{outcome.inspect} received instead"
|
|
82
79
|
end
|
|
80
|
+
outcome
|
|
83
81
|
end
|
|
84
82
|
|
|
85
83
|
private
|
|
@@ -146,6 +146,21 @@ module Plutonium
|
|
|
146
146
|
# Pass form_action: false to prevent form from trying to generate URL (cloned record has id: nil)
|
|
147
147
|
extraction_record = resource_record?&.dup || resource_class.new
|
|
148
148
|
@submitted_resource_params ||= begin
|
|
149
|
+
# Pre-populate from submitted params so condition: procs evaluate against submitted
|
|
150
|
+
# values during extraction. Without this, a select whose choices: depend on a sibling
|
|
151
|
+
# attribute would see nil for that sibling (fresh/cloned record) and resolve to empty
|
|
152
|
+
# choices, causing AcceptsChoices to nullify a valid submitted value.
|
|
153
|
+
# attribute_names covers DB columns and `attribute :` declarations.
|
|
154
|
+
# The union with respond_to? also covers attr_accessor virtual attributes.
|
|
155
|
+
submitted = params[resource_param_key]&.to_unsafe_h || {}
|
|
156
|
+
base_keys = extraction_record.attribute_names.map(&:to_s)
|
|
157
|
+
# Also include attr_accessor virtual attributes not in attribute_names.
|
|
158
|
+
# Exclude AR association writers — they expect object instances, not param strings.
|
|
159
|
+
extra_keys = (submitted.keys.map(&:to_s) - base_keys).select { |k|
|
|
160
|
+
extraction_record.respond_to?("#{k}=") &&
|
|
161
|
+
extraction_record.class.reflect_on_association(k.to_sym).nil?
|
|
162
|
+
}
|
|
163
|
+
extraction_record.assign_attributes(submitted.slice(*(base_keys | extra_keys)))
|
|
149
164
|
extracted = build_form(extraction_record, form_action: false)
|
|
150
165
|
.extract_input(params, view_context:)[resource_param_key.to_sym].compact
|
|
151
166
|
clean_structured_inputs(current_definition, extracted)
|
|
@@ -262,6 +262,17 @@ module Plutonium
|
|
|
262
262
|
elsif action.bulk_action?
|
|
263
263
|
instance.resources = interactive_bulk
|
|
264
264
|
end
|
|
265
|
+
# Pre-populate sibling attributes from submitted params before rendering
|
|
266
|
+
# the form for extraction. When a select input's `choices:` depends on a
|
|
267
|
+
# sibling attribute and `condition:` guards it, the condition evaluates to
|
|
268
|
+
# false on a fresh instance (sibling is nil), making AcceptsChoices
|
|
269
|
+
# validate against an empty choices list and nullify a valid submitted
|
|
270
|
+
# value. Pre-populating lets conditions evaluate against submitted values,
|
|
271
|
+
# so the real select (with correct choices) is used for extraction.
|
|
272
|
+
submitted = params[:interaction]&.to_unsafe_h || {}
|
|
273
|
+
base_keys = instance.attribute_names.map(&:to_s) - %w[resource resources]
|
|
274
|
+
extra_keys = submitted.keys.map(&:to_s).select { |k| instance.respond_to?("#{k}=") } - %w[resource resources]
|
|
275
|
+
instance.assign_attributes(submitted.slice(*(base_keys | extra_keys)))
|
|
265
276
|
extracted = interaction
|
|
266
277
|
.build_form(instance)
|
|
267
278
|
.extract_input(params, view_context:)[:interaction]
|
data/lib/plutonium/version.rb
CHANGED
data/package.json
CHANGED
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: plutonium
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.58.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Stefan Froelich
|
|
8
8
|
bindir: exe
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date: 2026-06-
|
|
10
|
+
date: 2026-06-10 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: zeitwerk
|