inline_forms 8.0.3 → 8.0.4

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: dbf71e495b41149f884052c32a5cfb1a0d01148c2cc957373e63803ac4bc7c00
4
- data.tar.gz: 108b9f3bdd412bbff043bea5808a5920172a7c33f3ff126afa209684af33fb3e
3
+ metadata.gz: 83fc3ebab88e414806da9e2c7f9a47088eb1d69579f607af783e647f374ada2b
4
+ data.tar.gz: 76348168e6d35fb88a7142e66e92938ae6938b83cd606a894f1985c37c7cd219
5
5
  SHA512:
6
- metadata.gz: c10d87d29d229849facdb2b06e0403de7ad6cb0442eb3f10126dc723894b2c28a0cd1e0e76a3c4acad9a7e4efa3fd292bc53604293eb124cd99b0de1d76d45a8
7
- data.tar.gz: 202650e4e15e768e585110e94f8901498f6ae718f35c47c2f81c9f18e94d38350fb1a4a3fbf8cc33b2f8976d90bd9db0daca322fdb901e1873afc13b6b3ca950
6
+ metadata.gz: d3d2b9b5a2cc0239857123cf16cd6605f58d27e324accddb8232015445767e3b06214c4c869d6089218b42aa72f737a11611d83abc3b53e731573ea628987944
7
+ data.tar.gz: 29d10dd86bb1c3bff98a5653b513de213e08250ab43b3fd3969e1aeaa71cd690f73f9034f51c64e775debeff69abd6180b5895867e7c4ca0a9aa10bda879fe07
data/CHANGELOG.md CHANGED
@@ -4,13 +4,29 @@ All notable changes to this project are documented in this file.
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [8.0.4] - 2026-05-24
8
+
9
+ ### Added
10
+
11
+ - **`inline_forms create --user-model` (`-U`):** choose the Devise-backed model class (e.g. `Member`). Default remains `User`. Non-default models use `devise_for :users, class_name: "…", path: "…"` so Warden scope stays `:user` (`current_user`, `destroy_user_session_path`, etc.). Installer generates matching table, routes, controller, Locale/Role associations, HABTM join table (`members_roles`, etc.), seeds, Ability guest user, and `--example` test substitutions.
12
+
13
+ ### Changed
14
+
15
+ - **`version_modified_by`:** resolves the auth model via `Devise.mappings[:users]` instead of hard-coding `User` (PaperTrail “modified by” on custom auth models).
16
+
7
17
  ## [8.0.3] - 2026-05-22
8
18
 
19
+ ### Added
20
+
21
+ - **Rails 8 release docs (Phase 5):** [`docs/rails-8-release.md`](docs/rails-8-release.md) (gate results, stack table); [`docs/zeitwerk-and-load-paths.md`](docs/zeitwerk-and-load-paths.md) (intentional ignores vs autoloaded paths).
22
+ - **Example app gate (recorded):** `inline_forms create MyApp -d sqlite --example` → **88 runs, 502 assertions, 0 failures**; `rails zeitwerk:check` → clean.
23
+
9
24
  ### Changed
10
25
 
11
26
  - **Rails 8 (Phase 4):** framework-defaults audit documented in [`docs/rails-8-phase4-audit.md`](docs/rails-8-phase4-audit.md); generated apps stay on `load_defaults 8.0` only (no `new_framework_defaults_8_0.rb`, matching `rails new` 8.0.5).
12
27
  - **Unicorn template:** `before_fork` uses `ActiveRecord::Base.connection_pool.disconnect!` (Rails 8–compatible).
13
28
  - **README.rdoc:** requirements table for Ruby 4 / Rails 8 / validation_hints 8; remove stale “broken after 6.2.14” notice; `rails-i18n ~> 8.0` narrative.
29
+ - **`inline_forms.gemspec`:** summary/description updated for Rails 8 (remove stale “broken after 6.2.14” text).
14
30
 
15
31
  ## [8.0.2] - 2026-05-22
16
32
 
data/README.rdoc CHANGED
@@ -30,6 +30,12 @@ If you want to install the example application:
30
30
 
31
31
  inline_forms create MyApp -d sqlite --example
32
32
 
33
+ To use a different Devise model (e.g. +Member+ on a +members+ table) while keeping Warden scope +:user+ so +current_user+ works in inline_forms:
34
+
35
+ inline_forms create MyApp -d sqlite --example --user-model Member
36
+
37
+ The installer emits +devise_for :users, class_name: "Member", path: "members"+ (sign-in at +/auth/members/sign_in+), +resources :members+, and the usual +authenticate_user!+ / +destroy_user_session_path+ helpers.
38
+
33
39
  Then point your browser to http://localhost:3000/apartments and log in with admin@example.com / admin999. The example also adds integration and model tests; run +bundle exec rails test+ in +MyApp+, then start the server with +bundle exec rails s+ when you want the UI.
34
40
 
35
41
  The example app now ships three models:
@@ -347,9 +347,14 @@ module InlineFormsHelper
347
347
  values
348
348
  end
349
349
 
350
- def version_modified_by id
351
- user = User.find_by_id id
352
- user.nil? ? 'Unknown' : user.name
350
+ def version_modified_by(id)
351
+ return "Unknown" if id.blank?
352
+
353
+ user_class = Devise.mappings[:users]&.to
354
+ return "Unknown" unless user_class
355
+
356
+ user = user_class.find_by(id: id)
357
+ user.nil? ? "Unknown" : user.name
353
358
  end
354
359
 
355
360
  end
@@ -0,0 +1,56 @@
1
+ # Rails 8.0 release (8.0.x line)
2
+
3
+ **Shipped:** 2026-05-22
4
+ **Tags:** `v8.0.3` (inline_forms, inline_forms_installer, validation_hints)
5
+
6
+ ## Stack
7
+
8
+ | Component | Constraint |
9
+ |-----------|------------|
10
+ | Ruby | `>= 4.0` (generated apps: `ruby-4.0.4`) |
11
+ | Rails | `>= 8.0`, `< 8.1` |
12
+ | rails-i18n | `>= 8.0`, `< 9.0` |
13
+ | validation_hints | `>= 8.0.2`, `< 9.0` (release **8.0.3** lockstep) |
14
+
15
+ Install CLI:
16
+
17
+ ```bash
18
+ gem install inline_forms_installer
19
+ inline_forms create MyApp -d sqlite --example
20
+ ```
21
+
22
+ Pre-release local builds: installer auto-installs `*.gem` from `~/inline_forms` / `~/validation_hints` when present (no `path:` in consumer Gemfiles).
23
+
24
+ ## Verification gate (2026-05-22)
25
+
26
+ | Check | Result |
27
+ |-------|--------|
28
+ | validation_hints `rake test` | 24 runs, 50 assertions, 0 failures |
29
+ | inline_forms `rake test` | 24 runs, 89 assertions, 0 failures |
30
+ | `inline_forms create MyApp -d sqlite --example` | OK (Rails 8.0.5) |
31
+ | `bundle exec rails zeitwerk:check` | All is good! |
32
+ | `bundle exec rails test` (MyApp) | **88 runs, 502 assertions, 0 failures, 0 errors, 0 skips** |
33
+ | `bundler-audit` (validation_hints lockfile) | No vulnerabilities found |
34
+
35
+ ## Migration phases (maintainer runbook)
36
+
37
+ Canonical step-by-step: `stuff/rails8forReal.md` (local; gitignored in this repo). Mirror checklist: `validation_hints/stuff/rails-8-checklist.md`.
38
+
39
+ | Phase | Status |
40
+ |-------|--------|
41
+ | 0 Baseline | Done |
42
+ | 1 validation_hints → AR 8 | Done (8.0.1+) |
43
+ | 2 inline_forms engine → Rails 8 | Done (8.0.1+) |
44
+ | 3 Installer + example app | Done (8.0.2+) |
45
+ | 4 Framework defaults + audit | Done (8.0.3) — [`rails-8-phase4-audit.md`](rails-8-phase4-audit.md) |
46
+ | 5 Release + docs | Done (8.0.3) — this file |
47
+
48
+ ## Zeitwerk
49
+
50
+ See [`zeitwerk-and-load-paths.md`](zeitwerk-and-load-paths.md). No remaining active code on pre-Zeitwerk `app/helpers/form_elements/` paths.
51
+
52
+ ## Deferred
53
+
54
+ - Dart Sass 3.0 (`@import` removal) — not released; deprecations only on Dart Sass 1.x
55
+ - [`stuff/towards_rails_8.md`](../stuff/towards_rails_8.md) product bets (auth, encryption, …) — post-ship
56
+ - Asset pipeline (`stuff/pipeline.md`) — orthogonal
@@ -0,0 +1,49 @@
1
+ # Zeitwerk and load paths (inline_forms + validation_hints)
2
+
3
+ **Last verified:** 2026-05-22 — `bundle exec rails zeitwerk:check` on a fresh **`inline_forms create MyApp -d sqlite --example`** app (Rails **8.0.5**): **All is good!**
4
+
5
+ ## inline_forms engine
6
+
7
+ ### Autoloaded by Zeitwerk (host app eager load)
8
+
9
+ Under the engine’s `app/` tree:
10
+
11
+ - `app/controllers/` — `InlineFormsController`, concerns
12
+ - `app/helpers/inline_forms_helper.rb`
13
+ - `app/models/concerns/inline_forms/soft_deletable.rb`
14
+ - `app/validators/*` — custom validators
15
+
16
+ ### Intentionally **not** Zeitwerk-autoloaded
17
+
18
+ | Path | Mechanism | Why |
19
+ |------|-----------|-----|
20
+ | `lib/inline_forms/form_elements/*_helper.rb` | `Rails.autoloaders.main.ignore` + `FormElements.load_helpers!` (`Dir[]` + `require`) | Historical top-level helper method names (`text_field_show`, …); `_helper.rb` filenames do not map to Zeitwerk constants |
21
+ | `lib/inline_forms.rb` boot | Explicit `require` of version, registry, `form_elements`, `turbo_tabs_builder`, `archived_form_elements` | Boot order before engine initializers |
22
+ | `lib/generators/` | Rails generator autoload | Not part of host app Zeitwerk |
23
+ | `archived/form_elements/` | Not required | Legacy project-specific elements; registry blocks use in `inline_forms_attribute_list` |
24
+
25
+ Track B migration (7.13.x): moved active elements from `app/helpers/form_elements/*.rb` to `lib/inline_forms/form_elements/*_helper.rb`. See `CHANGELOG.md` (Zeitwerk / form elements).
26
+
27
+ ### Nothing left on the old path
28
+
29
+ There is **no** `app/helpers/form_elements/` in the shipped gem (only under `archived/`).
30
+
31
+ ## validation_hints
32
+
33
+ | Path | Mechanism | Why |
34
+ |------|-----------|-----|
35
+ | `lib/active_model/hints.rb` | Explicit `require` in `lib/validation_hints.rb` | Defines `ActiveModel::Hints` in the `ActiveModel` namespace (collapse); not under `validation_hints/` |
36
+ | `lib/validation_hints/validations_patch.rb` | Explicit `require` | Patches applied via `ActiveSupport.on_load(:active_model)` |
37
+ | `lib/validation_hints/railtie.rb` | Loaded when `Rails::Railtie` is defined | Standard gem entry |
38
+
39
+ Non-Rails use: `require "validation_hints"` loads hints + patch + I18n without Zeitwerk.
40
+
41
+ ## Host app checklist
42
+
43
+ After upgrading or generating an app:
44
+
45
+ ```bash
46
+ cd MyApp && rvm use . && bundle exec rails zeitwerk:check
47
+ ```
48
+
49
+ If you vendor custom form-element helpers into the host app, keep them under `app/helpers/` with Zeitwerk-friendly names or add `config.autoload_lib` / ignores as needed.
data/inline_forms.gemspec CHANGED
@@ -10,8 +10,8 @@ Gem::Specification.new do |s|
10
10
  s.authors = ["Ace Suares", "Lemuel Boyce", "Manuel Ortega"]
11
11
  s.email = ["ace@suares.com"]
12
12
  s.homepage = %q{http://github.com/acesuares/inline_forms}
13
- s.summary = %q{Inline editing of forms. Versions after 6.2.14 are currently broken.}
14
- s.description = %q{Inline Forms aims to ease the setup of forms that provide inline editing. The field list can be specified in the model. Versions after 6.2.14 are currently broken, and we will post a notice when the gem is good again.}
13
+ s.summary = %q{Inline editing of forms for Rails 8.}
14
+ s.description = %q{Inline Forms eases setup of admin-style forms with inline editing. Field lists are declared on the model. Requires Rails 8.0.x, Ruby >= 4.0, and validation_hints ~> 8.}
15
15
  s.licenses = ["MIT"]
16
16
  s.required_ruby_version = ">= 4.0.0"
17
17
 
@@ -19,7 +19,7 @@ Gem::Specification.new do |s|
19
19
  s.test_files = s.files.grep(%r{^(test|spec|features)/})
20
20
  s.require_paths = ["lib"]
21
21
 
22
- s.add_dependency("validation_hints", ">= 8.0.2", "< 9.0")
22
+ s.add_dependency("validation_hints", ">= 8.0.4", "< 9.0")
23
23
  s.add_dependency("rails", ">= 8.0", "< 8.1")
24
24
  s.add_dependency("rails-i18n", ">= 8.0", "< 9.0")
25
25
 
@@ -1,4 +1,4 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  module InlineForms
3
- VERSION = "8.0.3"
3
+ VERSION = "8.0.4"
4
4
  end
@@ -0,0 +1,43 @@
1
+ # -*- encoding : utf-8 -*-
2
+ require "minitest/autorun"
3
+ require "inline_forms_installer/user_model_config"
4
+
5
+ class UserModelConfigTest < Minitest::Test
6
+ def test_default_user
7
+ cfg = InlineFormsInstaller::UserModelConfig.from_name("User")
8
+ assert cfg.default?
9
+ assert_equal "users", cfg.table_name
10
+ assert_equal "devise_for :users, :path_prefix => 'auth'", cfg.devise_route_line
11
+ assert_equal "/auth/users/sign_in", cfg.sign_in_path_fragment
12
+ end
13
+
14
+ def test_member
15
+ cfg = InlineFormsInstaller::UserModelConfig.from_name("Member")
16
+ refute cfg.default?
17
+ assert_equal "Member", cfg.class_name
18
+ assert_equal "members", cfg.table_name
19
+ assert_equal "member_id", cfg.foreign_key
20
+ assert_equal "members_roles", cfg.join_table
21
+ assert_equal "MembersController", cfg.controller_name
22
+ assert_includes cfg.devise_route_line, 'class_name: "Member"'
23
+ assert_includes cfg.devise_route_line, 'path: "members"'
24
+ assert_equal "/auth/members/sign_in", cfg.sign_in_path_fragment
25
+ end
26
+
27
+ def test_adapts_example_tests
28
+ cfg = InlineFormsInstaller::UserModelConfig.from_name("Member")
29
+ src = "user = User.find_or_initialize_by(email: \"admin@example.com\")\n"
30
+ assert_includes cfg.adapt_example_test_source(src), "Member.find_or_initialize_by"
31
+ guest = "assert_match %r{/auth/users/sign_in}, @response.redirect_url\n"
32
+ assert_includes cfg.adapt_example_test_source(guest), "/auth/members/sign_in"
33
+ end
34
+
35
+ def test_rejects_invalid_constant
36
+ assert_raises(ArgumentError) { InlineFormsInstaller::UserModelConfig.from_name("not-a-class") }
37
+ end
38
+
39
+ def test_from_env_defaults_to_user
40
+ env = { "user_model" => "" }
41
+ assert InlineFormsInstaller::UserModelConfig.from_env(env).default?
42
+ end
43
+ 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.0.3
4
+ version: 8.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ace Suares
@@ -17,7 +17,7 @@ dependencies:
17
17
  requirements:
18
18
  - - ">="
19
19
  - !ruby/object:Gem::Version
20
- version: 8.0.2
20
+ version: 8.0.4
21
21
  - - "<"
22
22
  - !ruby/object:Gem::Version
23
23
  version: '9.0'
@@ -27,7 +27,7 @@ dependencies:
27
27
  requirements:
28
28
  - - ">="
29
29
  - !ruby/object:Gem::Version
30
- version: 8.0.2
30
+ version: 8.0.4
31
31
  - - "<"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '9.0'
@@ -85,9 +85,9 @@ dependencies:
85
85
  - - "~>"
86
86
  - !ruby/object:Gem::Version
87
87
  version: '5.0'
88
- description: Inline Forms aims to ease the setup of forms that provide inline editing.
89
- The field list can be specified in the model. Versions after 6.2.14 are currently
90
- broken, and we will post a notice when the gem is good again.
88
+ description: Inline Forms eases setup of admin-style forms with inline editing. Field
89
+ lists are declared on the model. Requires Rails 8.0.x, Ruby >= 4.0, and validation_hints
90
+ ~> 8.
91
91
  email:
92
92
  - ace@suares.com
93
93
  executables: []
@@ -497,8 +497,10 @@ files:
497
497
  - docs/prompt/.gitignore
498
498
  - docs/prompt/test-the-example-app.md
499
499
  - docs/rails-8-phase4-audit.md
500
+ - docs/rails-8-release.md
500
501
  - docs/turbo-stream-audit.md
501
502
  - docs/ujs-to-turbo.md
503
+ - docs/zeitwerk-and-load-paths.md
502
504
  - inline_forms.gemspec
503
505
  - lib/generators/USAGE
504
506
  - lib/generators/assets/stylesheets/inline_forms.scss
@@ -569,6 +571,7 @@ files:
569
571
  - test/inline_forms_generator_test.rb
570
572
  - test/plain_text_configuration_test.rb
571
573
  - test/test_helper.rb
574
+ - test/user_model_config_test.rb
572
575
  - vendor/assets/javascripts/popper.min.js
573
576
  - vendor/assets/javascripts/tippy-bundle.umd.min.js
574
577
  - vendor/assets/stylesheets/tippy.css
@@ -592,7 +595,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
592
595
  requirements: []
593
596
  rubygems_version: 4.0.10
594
597
  specification_version: 4
595
- summary: Inline editing of forms. Versions after 6.2.14 are currently broken.
598
+ summary: Inline editing of forms for Rails 8.
596
599
  test_files:
597
600
  - test/archived_form_elements_test.rb
598
601
  - test/form_element_from_callee_test.rb
@@ -600,3 +603,4 @@ test_files:
600
603
  - test/inline_forms_generator_test.rb
601
604
  - test/plain_text_configuration_test.rb
602
605
  - test/test_helper.rb
606
+ - test/user_model_config_test.rb