inline_forms 8.1.2 → 8.1.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: 1cb2062c3fc919203715606f7a499b51f35cac4882d681098499e48ee7b6f06f
4
- data.tar.gz: 8f08d99f8c9b161c398919747e8fe457e0e6c91370d721eb8e300e9fd89d934a
3
+ metadata.gz: 312520779c0b8e5a1d2ac65ae7baceaaf2c855dd200b0ea26d41920e48a8854d
4
+ data.tar.gz: 62441eb7d1dde51a0479c3f7225ff8a13cb7d6e6d72a5a23ce595a14c5b74aef
5
5
  SHA512:
6
- metadata.gz: f72943d7626636b4657c09b79aa47feff78fd533fe179bcc5200322ba49b48dceee70b4cff15362b715af47d34e40c0ff2184e879c1e0cee715698bd236cd223
7
- data.tar.gz: e7aea2a16935eb0c0fb7bae12a2c2bd83ed1ce8324d29d750523c624e72b15233574d18f520bb64b4c8495a054a7d841958451c83a81608e3f6f62cc6b55346b
6
+ metadata.gz: 3bf891bc7e1c84468cd5685fd73d238f4faa80779386d04dd45ef64f7057c1758b6ff8c2d294a745fe2c0e128cc2b0db28273a0ee4ed42cea4afa464c89f4fb3
7
+ data.tar.gz: a6f5f42359b955b53dcd907b44cf07ee3a96081f666edb2e7a01f266c4879973af34db664daed3270c392567734e1dfcdb8daf55d2fd64856f9102296c4f10f4
data/CHANGELOG.md CHANGED
@@ -4,6 +4,38 @@ All notable changes to this project are documented in this file.
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [8.1.4] - 2026-05-26
8
+
9
+ ### Fixed
10
+
11
+ - **Search box on `/users` (or `/members`, etc.) silently returned the full list.** The installer-generated user model declared `scope :inline_forms_list, -> { order(:name, :id) }` but **no** `inline_forms_search` scope, so `InlineFormsController#index`'s `merge(@Klass.inline_forms_search(params[:search]))` fell through to the `ApplicationRecord` no-op (`scope :inline_forms_search, ->(_q) { all }`) and emitted `SELECT … FROM users ORDER BY name ASC, id ASC LIMIT 7` — no `WHERE`, no filter, regardless of the search query. Installer's `User` / `<custom>` model template now ships `scope :inline_forms_search, ->(q) { where("name LIKE :q OR email LIKE :q", q: "%#{q}%") }`, so `/users?search=ad` now returns rows whose name or email matches `%ad%`. Custom user-model classes via `-U <Class>` get the same scope.
12
+ - **Top-bar "More" dropdown was empty in every generated app** (long-standing latent bug). `lib/generators/inline_forms_generator.rb#add_tab` looked for the marker `ActionView::CompiledTemplates::MODEL_TABS = %w(` in `app/controllers/application_controller.rb`, but the installer wrote the initializer at `config/initializers/inline_forms.rb` with the marker `MODEL_TABS = %w(` and the application controller had no marker at all. Thor's `inject_into_file` silently skipped (no error, no message), so `MODEL_TABS` stayed `%w()` through every `rails g inline_forms` call. The header partial (`app/views/inline_forms/_header.html.erb`) iterated an empty list and the dropdown rendered just the chevron with no children — for years.
13
+ - `add_tab` now targets `config/initializers/inline_forms.rb` with the simpler marker `MODEL_TABS = %w(`, no-ops if the file or marker is missing (so consumers running `rails g inline_forms` in a non-installer-shaped app still work), and stays idempotent on re-run (skips the token if already present).
14
+ - Installer's initializer is now created **before** the `Locale` / `Role` `generate "inline_forms"` calls (was created at the end of the run), and is pre-seeded with the user-model's pluralised route — `MODEL_TABS = %w(<plural_route> )` — because the user model is hand-written by the installer (not generated) and would otherwise never be added.
15
+ - Net effect on a fresh `inline_forms create MyApp -d sqlite --example`: `MODEL_TABS = %w(owners apartments roles locales users )` (with `-U Member`: `… members `). The top-bar "More" dropdown now lists every HTML-reachable model the current `current_user` `can? :update`.
16
+
17
+ ### Changed
18
+
19
+ - **Test skeleton (`test/inline_forms_generator_test.rb#build_destination_skeleton!`)** writes `config/initializers/inline_forms.rb` with `MODEL_TABS = %w()` (matching the installer) instead of the legacy `ActionView::CompiledTemplates::MODEL_TABS = %w()` in `application_controller.rb`. `test_generates_model_controller_route_migration_and_tab_injection` now asserts the token lands in the initializer.
20
+
21
+ ### Notes
22
+
23
+ - **Example app gate (recorded):** `inline_forms create MyApp -d sqlite --example` against the freshly built **8.1.4** gem trio: install in ~71s, `bundle check: ok`, `MODEL_TABS = %w(owners apartments roles locales users )` in the initializer, **88 runs, 502 assertions, 0 failures, 0 errors, 0 skips**. Same result with `-U Member`, with `users → members` in `MODEL_TABS`.
24
+
25
+ ## [8.1.3] - 2026-05-26
26
+
27
+ ### Changed
28
+
29
+ - **PaperTrail 17.0:** generated app Gemfile bumped from `paper_trail ~> 16.0` to `paper_trail ~> 17.0`. PT 17 officially supports Rails 8.1 (it drops Rails 6.1 / 7.0 and Ruby 3.0 / 3.1, all out of scope here) and silences the "PaperTrail 16.0.0 is not compatible with ActiveRecord 8.1.3" boot warning that PT 16 emitted under our 8.1 stack. No installer / engine code changes needed — `has_paper_trail`, the rich-text mirror initializer, and the YAML safe-load initializer all work unchanged.
30
+
31
+ ### Added
32
+
33
+ - **`inline_forms create -U <Class>` collision check.** The installer always generates `Locale` and `Role`; with `--example`, it also generates `Photo`, `Apartment`, and `Owner`. Passing `-U Locale|Role` (with or without `--example`) or `-U Photo|Apartment|Owner` together with `--example` previously aborted halfway through with a Thor `conflict app/models/<name>.rb` prompt because the user model file (generated first) was about to be overwritten by the example app's `rails g inline_forms <Name>`. `Creator#create` now rejects these combinations up front with an actionable red error before `rails new` runs.
34
+
35
+ ### Notes
36
+
37
+ - **Example app gate (recorded):** `inline_forms create MyApp -d sqlite --example` against the freshly built **8.1.3** gem trio on `rails 8.1.3` / `paper_trail 17.0.0`: install completes cleanly (no PT compatibility warning), `bundle check: ok`, **88 runs, 502 assertions, 0 failures, 0 errors, 0 skips**.
38
+
7
39
  ## [8.1.2] - 2026-05-26
8
40
 
9
41
  ### Changed
data/inline_forms.gemspec CHANGED
@@ -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.1.2", "< 9.0")
22
+ s.add_dependency("validation_hints", ">= 8.1.4", "< 9.0")
23
23
  s.add_dependency("rails", ">= 8.1", "< 8.2")
24
24
  s.add_dependency("rails-i18n", ">= 8.1", "< 9.0")
25
25
 
@@ -186,11 +186,22 @@ module InlineForms
186
186
  def add_tab
187
187
  return if @flag_not_accessible_through_html
188
188
 
189
- relative_path = "app/controllers/application_controller.rb"
190
- marker = "ActionView::CompiledTemplates::MODEL_TABS = %w("
189
+ # The installer seeds `MODEL_TABS = %w(<user_model_route> )` in
190
+ # `config/initializers/inline_forms.rb` before any `rails g inline_forms`
191
+ # runs. Inject each generated model's pluralised route token into that
192
+ # list so the inline_forms top-bar dropdown (rendered by
193
+ # `app/views/inline_forms/_header.html.erb`) surfaces every
194
+ # HTML-reachable model. No-op when the initializer is absent (e.g. a
195
+ # consumer running `rails g inline_forms` in a non-installer-shaped app)
196
+ # or when the token is already present (idempotent re-run).
197
+ relative_path = "config/initializers/inline_forms.rb"
198
+ marker = "MODEL_TABS = %w("
191
199
  tab_token = "#{name.pluralize.underscore} "
192
200
  full_path = File.join(destination_root, relative_path)
201
+ return unless File.exist?(full_path)
202
+
193
203
  content = File.read(full_path)
204
+ return unless content.include?(marker)
194
205
  return if content.include?(tab_token.rstrip)
195
206
 
196
207
  inject_into_file relative_path, tab_token, after: marker
@@ -1,4 +1,4 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  module InlineForms
3
- VERSION = "8.1.2"
3
+ VERSION = "8.1.4"
4
4
  end
@@ -32,7 +32,7 @@ class InlineFormsGeneratorTest < Minitest::Test
32
32
  model = read("app/models/thing.rb")
33
33
  controller = read("app/controllers/things_controller.rb")
34
34
  routes = read("config/routes.rb")
35
- application_controller = read("app/controllers/application_controller.rb")
35
+ inline_forms_initializer = read("config/initializers/inline_forms.rb")
36
36
  migration = read_single_migration_for("things")
37
37
 
38
38
  assert_includes(model, "class Thing < ApplicationRecord")
@@ -54,7 +54,7 @@ class InlineFormsGeneratorTest < Minitest::Test
54
54
  assert_includes(routes, "post 'revert', :on => :member")
55
55
  assert_includes(routes, "get 'list_versions', :on => :member")
56
56
 
57
- assert_includes(application_controller, "MODEL_TABS = %w(things ")
57
+ assert_includes(inline_forms_initializer, "MODEL_TABS = %w(things ")
58
58
 
59
59
  assert_includes(migration, "class InlineFormsCreateThings < ActiveRecord::Migration[8.1]")
60
60
  assert_includes(migration, "create_table :things do |t|")
@@ -175,6 +175,7 @@ class InlineFormsGeneratorTest < Minitest::Test
175
175
 
176
176
  def build_destination_skeleton!
177
177
  mkdir_p("config")
178
+ mkdir_p("config/initializers")
178
179
  mkdir_p("app/controllers")
179
180
  mkdir_p("app/models")
180
181
  mkdir_p("db/migrate")
@@ -192,7 +193,17 @@ class InlineFormsGeneratorTest < Minitest::Test
192
193
  "app/controllers/application_controller.rb",
193
194
  <<~RUBY
194
195
  class ApplicationController < ActionController::Base
195
- ActionView::CompiledTemplates::MODEL_TABS = %w()
196
+ end
197
+ RUBY
198
+ )
199
+
200
+ # Matches the file the installer writes; the generator's `add_tab` step
201
+ # injects `<plural_route> ` tokens after the `MODEL_TABS = %w(` marker.
202
+ write(
203
+ "config/initializers/inline_forms.rb",
204
+ <<~RUBY
205
+ Rails.application.reloader.to_prepare do
206
+ MODEL_TABS = %w()
196
207
  end
197
208
  RUBY
198
209
  )
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.2
4
+ version: 8.1.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.1.2
20
+ version: 8.1.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.1.2
30
+ version: 8.1.4
31
31
  - - "<"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '9.0'
@@ -587,7 +587,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
587
587
  - !ruby/object:Gem::Version
588
588
  version: '0'
589
589
  requirements: []
590
- rubygems_version: 4.0.10
590
+ rubygems_version: 4.0.12
591
591
  specification_version: 4
592
592
  summary: Inline editing of forms for Rails 8.
593
593
  test_files: