inline_forms 8.1.17 → 8.1.19

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: b7336d7c761e22dd4378a0c2d01b54f7558a2a29d9818a085b4478c17e664ead
4
- data.tar.gz: 3e08954932efda044a18cf4f4a68ad3299ffdb382581c9369bc733023ff57906
3
+ metadata.gz: fb00bfea980d5563c8c6efdccfec5f570bf143487d0d25ddb790d38e8bb1e5a6
4
+ data.tar.gz: d843e74f5c4677993a8bc82454adb48db73477f3182dffe56dd0b9a389263258
5
5
  SHA512:
6
- metadata.gz: 93339e380b5d224fe1b1d3b5459cc6675682ed81bd87f7a28594afafaa9304b50467dc8cb2b628641c78fb39ba68649c02fd9a38b154388815458e51e2781afe
7
- data.tar.gz: e33e98b2676db0ec7d0af1196a1bf9be4b423b231d52f9636391fd830fdb29779a6e03381a5150bdde4258374ec13c4ad3b908f55cdd1e3ebf2d03ad86ac2cbc
6
+ metadata.gz: b3864e91f61f48eeb3d6914c2f5651dec600ab4de3aeff91ee3bcbc4fa685603cfce59429d4baa7169d761d9e052891e03b8f6b070e693929a7c2638ecd1b70f
7
+ data.tar.gz: d279266cd6030c0464f2db416b4d50da554b539fc8382e77e78c75633d159057b42b7c7d81e671bfe884f598b1180816fca4af79d4e7d69bd6aa0e899ec41794
data/CHANGELOG.md CHANGED
@@ -4,6 +4,33 @@ All notable changes to this project are documented in this file.
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [8.1.19] - 2026-05-28
8
+
9
+ ### Fixed
10
+
11
+ - **Inline attribute `update` no longer renders a fake success on a failed save.** `InlineFormsController#update` called `@object.save` but ignored its return value, then unconditionally re-rendered `field_show` from the in-memory `@object`. When the save failed validation the user saw a "show" of the unsaved in-memory value while the DB row kept its old value — re-opening the edit surprised the user with the old value. `update` now branches on `@object.save`: on success it renders the show as before; on failure it re-renders the **edit** field (mirroring how `create` handles a failed save) with the validation errors in `flash.now[:error]`, so the user stays in the editor and can correct the input. This is a general fix affecting every form element, not just `money_field`.
12
+ - **`money_field` malformed input regression.** money-rails rejects an unparseable amount such as `"99.ace99"` (the monetized validator fails, so `save` returns false and `amount_cents` is never written). Previously the inline edit showed a "saved" `$99.99` show that did not reflect the database. Now the edit field is re-rendered, and `money_field_edit` prefers the raw submitted `params[attribute]` over `object.send(attribute)` so the rejected input stays visible and editable instead of silently reverting.
13
+
14
+ ### Added
15
+
16
+ - **Regression test:** `example_app_showcase_money_update_test.rb` POSTs a malformed `amount: "99.ace99"` inline update for the seeded `$99.95` "Full demo" `FormElementShowcase` and asserts the DB value is unchanged (`amount_cents == 9995`) and the response is the edit/error state (not a fake `$99.99` show), plus a positive path asserting a valid `"12.34"` persists (`amount_cents == 1234`) and renders the show.
17
+
18
+ ## [8.1.18] - 2026-05-28
19
+
20
+ ### Fixed
21
+
22
+ - **`Psych::DisallowedClass` (`ActiveRecord::Type::Time::Value`) in `FormElementShowcasesController#revert`.** A `:time` column (e.g. `FormElementShowcase#meeting_time`, a `:time_select` helper) stores its value as an `ActiveRecord::Type::Time::Value` — a `Time` subclass. PaperTrail serializes it under its real class name, so reverting (which calls `version.reify`, a path PaperTrail does *not* rescue) raised `Tried to load unspecified class: ActiveRecord::Type::Time::Value`. The generated `config/initializers/paper_trail_yaml_safe_load.rb` now also permits `ActiveRecord::Type::Time::Value`, `ActiveRecord::Type::Date::Value`, and `ActiveRecord::Type::DateTime::Value`, so revert and the versions panel round-trip date/time `_select` columns. (Previously-permitted `Time`/`Date` did not cover these subclasses — Psych matches the exact stored class name.)
23
+
24
+ ### Changed
25
+
26
+ - **RVM is now optional, not required.** The `rvm` gem is no longer a runtime dependency of `inline_forms_installer`, and `inline_forms create` no longer hard-`require`s it. The CLI uses RVM (auto-creating a per-app gemset) only when the `rvm` gem is installed *and* the shell is inside an RVM environment; otherwise it installs without RVM (any version manager — rbenv/chruby/asdf/mise — or none, with Bundler isolating deps per app via `Gemfile.lock`). `--no-rvm` still forces the no-RVM path. To opt in to gemset integration, `gem install rvm` before creating the app.
27
+ - **Generated `.ruby-version` now matches the version manager in use.** Non-RVM installs get a *bare* `4.0.4` (honored by rbenv/chruby/asdf/mise); RVM installs keep `ruby-4.0.4` (RVM's `.ruby-version` reader rejects a bare version, which would break `rvm use .` and the per-app gemset). `InlineFormsInstaller::TARGET_RUBY_VERSION` is the canonical bare `"4.0.4"`; the Creator adds the `ruby-` prefix only when RVM is active. The installer also force-writes the file (Rails' `rails new` emits its own `.ruby-version`), avoiding an interactive overwrite prompt.
28
+ - **Generated app `Gemfile` no longer lists the runtime `gem 'rvm'`** (the app never used the RVM Ruby API at runtime). The RVM-based Capistrano deploy helpers remain in the `:development` group for the shipped `config/deploy.rb`.
29
+
30
+ ### Added
31
+
32
+ - **Regression test:** a `FormElementShowcase` `meeting_time` (`:time_select`) PaperTrail version both reifies (revert path) and round-trips its `changeset` (versions-panel path) without raising `Psych::DisallowedClass`.
33
+
7
34
  ## [8.1.17] - 2026-05-28
8
35
 
9
36
  ### Fixed
data/README.rdoc CHANGED
@@ -4,10 +4,18 @@ Inline Forms is almost a complete admin application. You can try it out easily.
4
4
 
5
5
  = Requirements
6
6
 
7
- * Ruby **>= 4.0** (generated apps pin **ruby-4.0.4**)
7
+ * Ruby **>= 4.0** (generated apps pin **4.0.4** via +.ruby-version+)
8
8
  * Rails **8.1.x** (+rails ~> 8.1+, +config.load_defaults 8.1+)
9
9
  * **validation_hints** **~> 8** (companion gem; same version line as +inline_forms+ / +inline_forms_installer+)
10
10
 
11
+ = Ruby version managers (RVM is optional)
12
+
13
+ +inline_forms+ does *not* require RVM. Generated apps get a +.ruby-version+ whose format matches the version manager you are using: a *bare* +4.0.4+ for +rbenv+ / +chruby+ / +asdf+ / +mise+, or +ruby-4.0.4+ for RVM (whose +.ruby-version+ reader needs the +ruby-+ prefix). So any version manager — or none — works. Bundler isolates each app's gems through its own +Gemfile.lock+.
14
+
15
+ RVM integration is purely opt-in. If the +rvm+ gem is installed *and* your shell is inside an RVM environment, +inline_forms create+ additionally writes a +.ruby-gemset+ and installs into a per-app gemset. To enable that, +gem install rvm+ before creating the app. To skip RVM even when it is present, pass +--no-rvm+:
16
+
17
+ inline_forms create MyApp -d sqlite --example --no-rvm
18
+
11
19
  = Usage
12
20
 
13
21
  The +inline_forms create+ CLI ships in the +inline_forms_installer+ gem (not in +inline_forms+ itself). Install the installer to get the +inline_forms+ executable:
@@ -181,9 +181,25 @@ class InlineFormsController < ApplicationController
181
181
  @update_span = params[:update]
182
182
  InlineForms.assert_plain_text_column!(object: @object, attribute: @attribute, form_element: @form_element)
183
183
  send("#{@form_element.to_s}_update", @object, @attribute)
184
- @object.save
185
- respond_to do |format|
186
- format.html { render_turbo_field(:field_show, turbo_field_show: true) }
184
+ # Branch on the actual save result. Previously the return value of
185
+ # `@object.save` was ignored and `field_show` was rendered
186
+ # unconditionally from the in-memory `@object`. When a save failed
187
+ # validation (e.g. money-rails rejecting an unparseable amount, or any
188
+ # `validates` failure) the user saw a "show" of the unsaved in-memory
189
+ # value -- a fake success -- while the DB row kept its old value. A
190
+ # subsequent edit then re-read the old value, surprising the user.
191
+ #
192
+ # On failure we keep the user in the edit field with their rejected
193
+ # input visible and surface the validation errors (mirrors `create`).
194
+ if @object.save
195
+ respond_to do |format|
196
+ format.html { render_turbo_field(:field_show, turbo_field_show: true) }
197
+ end
198
+ else
199
+ flash.now[:error] = @object.errors.to_a
200
+ respond_to do |format|
201
+ format.html { render_turbo_field(:field_edit) }
202
+ end
187
203
  end
188
204
  end
189
205
 
@@ -27,7 +27,15 @@ module InlineForms
27
27
  end
28
28
 
29
29
  def money_field_edit(object, attribute)
30
- text_field_tag attribute, (object.send attribute), :class => 'input_money_field'
30
+ # On a fresh edit there is no submitted value, so fall back to the
31
+ # current Money value. On a re-render after a *failed* update
32
+ # (money-rails could not parse the input) `object.send(attribute)`
33
+ # no longer reflects what the user typed -- it returns the old/last
34
+ # parsed value -- so the user would silently lose their rejected
35
+ # input. Prefer the raw submitted `params[attribute]` so the bad
36
+ # value stays visible and editable.
37
+ value = params[attribute].presence || (object.send attribute)
38
+ text_field_tag attribute, value, :class => 'input_money_field'
31
39
  end
32
40
 
33
41
  def money_field_update(object, attribute)
@@ -1,4 +1,4 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  module InlineForms
3
- VERSION = "8.1.17"
3
+ VERSION = "8.1.19"
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inline_forms
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.1.17
4
+ version: 8.1.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ace Suares