inline_forms 7.13.2 → 7.13.3

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: 51e2a1ebb89510ad07098cd4bddbae4b312e8dba44deeae17a6594b9a78e7625
4
- data.tar.gz: ab154d4f32670f0dc27cd2fb34a55f9799fe0ca6e31f18b669eb278b6295a6c7
3
+ metadata.gz: ec05aa4e1a1a1f21dcd041e8022943ec84af7c9b1ad4ccd90a6f57721f1732cd
4
+ data.tar.gz: 05fac9919e1730afa9797d2b343a0c76484cf28c6ac0ca210daed96312699902
5
5
  SHA512:
6
- metadata.gz: bda0f225b64be4393f4de458a0757c563ec0ca9b769b106c071cfb18f9723965ad9cea96423f3fefa41f0a72104dda4212ae3b503bddf440cc0f16b6a6363f54
7
- data.tar.gz: 5d6f660d7c86a30c20a4030ae637f8dcf1fb14075c00cdbd0c3e9b542ef00f1261f231267e16bb1deb4948f020a943dfb3edcf2ee161f853b18b0992c7965c2a
6
+ metadata.gz: 927830ff6c84fa2642f243df6956725584b990814ffc10a357983b253117cb2c1c99f3dc7b304438becd1a20e962cae72df6714f4b570cac4c1a54fe65dc3134
7
+ data.tar.gz: ad534d4e02d38e4dc6d607e18a92725cda21334a73b5a41bbea096dd5bb830fc23697a58928345ac32426fe5c3939a46106fb176068e1aa696637f2a7e7dcd6b
data/CHANGELOG.md CHANGED
@@ -4,6 +4,30 @@ All notable changes to this project are documented in this file.
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [7.13.3] - 2026-05-19
8
+
9
+ ### Fixed
10
+
11
+ - **Versions panel — "empty" `update` row whose Restore link did nothing.** Creating a record with a `rich_text` field (e.g. a new Photo with a `description`) produced a parent-side PaperTrail `update` version with `changeset == {}`. Cause: PaperTrail 16 tracks `:touch` by default (`on: [:create, :update, :destroy, :touch]`), and ActionText's `belongs_to :record, polymorphic: true, touch: true` calls `parent.touch` on every rich-text save. The resulting version reified to the same state, so clicking Restore was a visible no-op.
12
+ - **`lib/generators/templates/model.erb`**: emit `has_paper_trail on: [:create, :update, :destroy]` (drop `:touch`). New `rails g inline_forms …` models no longer create these noise versions. Existing apps need to re-apply the change to their models.
13
+ - **`lib/inline_forms_installer/installer_core.rb`** (`config/initializers/rich_text_paper_trail.rb`): mirror the opt-out on `ActionText::RichText` for symmetry against any future `touch: true` association pointing at rich-text rows.
14
+ - **`app/views/inline_forms/_versions_list.html.erb`**: defensive view-side gate — hide the Restore link when `version.changeset` is `nil` or empty after dropping `updated_at`. Covers legacy apps that still track `:touch`, plus any other empty-update source (e.g. CarrierWave callbacks that don't change attributes). The row stays visible in the audit trail; only the dead Restore link is suppressed.
15
+
16
+ ### Added
17
+
18
+ - **`test/integration/example_app_apartment_versions_turbo_test.rb`** (installer template):
19
+ - `creating a record with a rich_text body does not append a touch-only parent update` — pins the generator-template change.
20
+ - `versions list hides Restore link on empty-changeset update rows` — pins the view-side guard against legacy `:touch` tracking.
21
+
22
+ ### Changed
23
+
24
+ - **`InlineForms::VERSION`** and **`InlineFormsInstaller::VERSION`** → `7.13.3` (installer's `INLINE_FORMS_VERSION = VERSION` writes the `gem "inline_forms", "~> X.Y.Z"` pin into generated `Gemfile`s).
25
+
26
+ ### Verified
27
+
28
+ - `gem build inline_forms.gemspec` → `inline_forms-7.13.3.gem`; `gem build inline_forms_installer.gemspec` → `inline_forms_installer-7.13.3.gem`.
29
+ - `inline_forms create MyApp -d sqlite --example` → `bundle exec rails test` — **81 runs, 0 failures, 0 errors, 0 skips** (Ruby 4.0.4 / Rails 7.2.3.1).
30
+
7
31
  ## [7.13.2] - 2026-05-19
8
32
 
9
33
  ### Fixed
@@ -55,9 +55,19 @@
55
55
  the record — primary records already have a dedicated Destroy
56
56
  button (superadmin), and rich_text content can be cleared by
57
57
  editing. Omitting the link here keeps the UI consistent and
58
- avoids a NoMethodError in the controller's `save!`. -%>
58
+ avoids a NoMethodError in the controller's `save!`.
59
+
60
+ Empty-changeset update rows (e.g. PaperTrail `touch` events from
61
+ `belongs_to ..., touch: true` on associated ActionText::RichText
62
+ or CarrierWave callbacks) reify the same state — Restore on them
63
+ is a visible no-op. New generated models opt out of touch
64
+ tracking (`has_paper_trail on: [:create, :update, :destroy]`),
65
+ but legacy apps still have these rows in the audit trail; the
66
+ link is hidden here so the action is never offered. -%>
59
67
  <% if version.event == "create" %>
60
68
  &nbsp;
69
+ <% elsif version.changeset.nil? || version.changeset.except("updated_at").empty? %>
70
+ &nbsp;
61
71
  <% else %>
62
72
  <% row_id = inline_forms_row_turbo_frame_id(@object) %>
63
73
  <%= link_to t("inline_forms.view.restore"),
@@ -2,7 +2,14 @@ class <%= name %> < ApplicationRecord
2
2
  attr_reader :per_page
3
3
  @per_page = 7
4
4
  attr_writer :inline_forms_attribute_list
5
- has_paper_trail
5
+ # PaperTrail 16 defaults to `on: [:create, :update, :destroy, :touch]`.
6
+ # ActionText's `belongs_to :record, polymorphic: true, touch: true` (set by
7
+ # `has_rich_text`) calls `parent.touch` on every rich-text save, which
8
+ # produced a parent-side `update` version with an empty changeset — visible
9
+ # in the inline_forms versions panel as a meaningless "empty" row whose
10
+ # Restore link reifies the same state (no-op). Excluding `:touch` here
11
+ # suppresses that noise without affecting real attribute updates.
12
+ has_paper_trail on: [:create, :update, :destroy]
6
13
  <%= @carrierwave_mounters if @carrierwave_mounters.length > 1 -%>
7
14
  <%= @belongs_to if @belongs_to.length > 1 -%>
8
15
  <%= @has_many if @has_many.length > 1 -%>
@@ -1,4 +1,4 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  module InlineForms
3
- VERSION = "7.13.2"
3
+ VERSION = "7.13.3"
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: 7.13.2
4
+ version: 7.13.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ace Suares