inline_forms 8.1.16 → 8.1.18

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: a523b9082f8bf1ada004984c1d3cc66e745cae0e525e36acbf66df97b7015e98
4
- data.tar.gz: d82f9950bde7f293ea70ef2e63162bcb304a0fac44eb6c8f645f88bbefe947da
3
+ metadata.gz: ecefaa077ab62a564bbe19f49b650f9c2468329809110c80658b3016f6257b3c
4
+ data.tar.gz: 3fa4eed9d358f8c49b88438575c2c32b5732da40759afebeef41be464cc604df
5
5
  SHA512:
6
- metadata.gz: 275bec7794f426e5131ae69843dfcb9bd2cec55ae9124075bc59ae0e171fc6df3d406ae776d78526a918a12dbc87aa41b0b12ade138fd4f520d75254570e6b01
7
- data.tar.gz: 33bb93de6e2f017d664b610e07105afea73708b5ee67a269b48bd68de6b3d0fa8b9688eab4c21882ea408a8fc7ab68fcf6e2a18ff733d56fad29110e5863790e
6
+ metadata.gz: 12844d6e2d41fed8e75a5ab4c5e5ef666ddac0b206285b8062b51185d648058f072b3db9ea0635b7b68d5b0f1450f495f45260f661dc53676be32f37826c70f9
7
+ data.tar.gz: 259eae56e0c02f5e52261601ea63dcb458e7a599faf8d3867fbb970e138f9c9f58623fe5146a312afdbe0cdea5e680d8f412cf9b625f62e1c0924dbff5622031
data/CHANGELOG.md CHANGED
@@ -4,6 +4,32 @@ All notable changes to this project are documented in this file.
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [8.1.18] - 2026-05-28
8
+
9
+ ### Fixed
10
+
11
+ - **`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.)
12
+
13
+ ### Changed
14
+
15
+ - **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.
16
+ - **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.
17
+ - **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`.
18
+
19
+ ### Added
20
+
21
+ - **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`.
22
+
23
+ ## [8.1.17] - 2026-05-28
24
+
25
+ ### Fixed
26
+
27
+ - **`RecordNotUnique` on `photos.id` (and any primary record) when restoring a `destroy` version while the row still exists.** PaperTrail records a non-empty changeset for `destroy` events, so the versions panel shows a Restore link on `destroy` rows. Reverting a `destroy` reifies a record with the original primary key and `new_record? == true`; the normal undo (row currently deleted) path correctly INSERTs it, but once the row had already been restored a blind `save!` re-INSERTed the existing id and raised `SQLite3::ConstraintException: UNIQUE constraint failed: photos.id`. `revert` now upserts the primary record by PK (mirroring the 8.1.16 rich-text fix): when a row with that id already exists, the reified column values are copied onto it and saved in place, so restoring a `destroy` version is idempotent across repeated delete/undo cycles.
28
+
29
+ ### Added
30
+
31
+ - **Regression test:** restore a Photo `destroy` version while the row still exists (panel Restore / replayed undo) must not raise `RecordNotUnique`.
32
+
7
33
  ## [8.1.16] - 2026-05-28
8
34
 
9
35
  ### 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:
@@ -318,8 +318,7 @@ class InlineFormsController < ApplicationController
318
318
  @rich_text_record.save!
319
319
  @parent.touch if @parent.respond_to?(:touch)
320
320
  else
321
- @parent = @object
322
- @parent.save!
321
+ @parent = persist_reverted_primary!(@object)
323
322
  restore_rich_texts_for_reverted_parent!(@parent)
324
323
  @parent.reload
325
324
  end
@@ -328,6 +327,33 @@ class InlineFormsController < ApplicationController
328
327
 
329
328
  private
330
329
 
330
+ # Persist a reified *primary* record (Apartment, Photo, ...) for +revert+.
331
+ #
332
+ # +reify+ on a +destroy+ version returns a record with +new_record? == true+
333
+ # carrying the original primary key. The normal undo (row currently deleted)
334
+ # path INSERTs that id and is correct. But the versions panel also offers
335
+ # Restore on +destroy+ rows (their changeset is non-empty in apps that track
336
+ # +object_changes+ on destroy), and the post-delete undo banner can be
337
+ # replayed. Once the row has been restored, a blind +save!+ re-INSERTs the
338
+ # existing id and raises +RecordNotUnique+ (SQLite: +UNIQUE constraint failed:
339
+ # photos.id+). Mirror the rich-text upsert (8.1.16): when a row with that PK
340
+ # already exists, copy the reified column values onto it and +save!+ that
341
+ # instead, so reverting is idempotent across repeated delete/undo cycles.
342
+ def persist_reverted_primary!(object)
343
+ klass = object.class
344
+ primary_key = klass.primary_key
345
+
346
+ if object.new_record? && object.id.present? && klass.exists?(object.id)
347
+ existing = klass.find(object.id)
348
+ existing.assign_attributes(object.attributes.except(primary_key))
349
+ existing.save!
350
+ existing
351
+ else
352
+ object.save!
353
+ object
354
+ end
355
+ end
356
+
331
357
  # Undoing a parent +destroy+ reifies the Apartment/Photo row only. ActionText
332
358
  # bodies live in +action_text_rich_texts+ and get their own PaperTrail
333
359
  # +destroy+ versions; those rows are gone after +parent.destroy+, so we also
@@ -1,4 +1,4 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  module InlineForms
3
- VERSION = "8.1.16"
3
+ VERSION = "8.1.18"
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.16
4
+ version: 8.1.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ace Suares