inertia_rails 3.22.0 → 3.23.0

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.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +42 -0
  3. data/README.md +11 -3
  4. data/app/controllers/inertia_rails/devtools/entries_controller.rb +43 -0
  5. data/lib/generators/inertia/install/install_generator.rb +18 -3
  6. data/lib/generators/inertia/install/templates/initializer.rb +2 -0
  7. data/lib/generators/inertia/install/templates/react/inertia.jsx +2 -0
  8. data/lib/generators/inertia/install/templates/react/inertia.tsx +2 -0
  9. data/lib/generators/inertia/install/templates/svelte/inertia.js +2 -0
  10. data/lib/generators/inertia/install/templates/svelte/inertia.ts +2 -0
  11. data/lib/generators/inertia/install/templates/vue/inertia.js +2 -0
  12. data/lib/generators/inertia/install/templates/vue/inertia.ts +2 -0
  13. data/lib/generators/inertia_templates/scaffold/templates/react/edit.jsx.tt +0 -5
  14. data/lib/generators/inertia_templates/scaffold/templates/react/edit.tsx.tt +0 -5
  15. data/lib/generators/inertia_templates/scaffold/templates/svelte/edit.svelte.tt +0 -5
  16. data/lib/generators/inertia_templates/scaffold/templates/svelte/edit.ts.svelte.tt +0 -5
  17. data/lib/generators/inertia_templates/scaffold/templates/vue/edit.ts.vue.tt +0 -5
  18. data/lib/generators/inertia_templates/scaffold/templates/vue/edit.vue.tt +0 -5
  19. data/lib/generators/inertia_templates/scaffold/templates/vue/index.ts.vue.tt +2 -2
  20. data/lib/generators/inertia_templates/scaffold/templates/vue/index.vue.tt +2 -2
  21. data/lib/generators/inertia_templates/scaffold/templates/vue/show.ts.vue.tt +2 -2
  22. data/lib/generators/inertia_templates/scaffold/templates/vue/show.vue.tt +2 -2
  23. data/lib/generators/inertia_tw_templates/scaffold/templates/react/edit.jsx.tt +0 -5
  24. data/lib/generators/inertia_tw_templates/scaffold/templates/react/edit.tsx.tt +0 -5
  25. data/lib/generators/inertia_tw_templates/scaffold/templates/svelte/edit.svelte.tt +0 -5
  26. data/lib/generators/inertia_tw_templates/scaffold/templates/svelte/edit.ts.svelte.tt +0 -5
  27. data/lib/generators/inertia_tw_templates/scaffold/templates/vue/edit.ts.vue.tt +1 -6
  28. data/lib/generators/inertia_tw_templates/scaffold/templates/vue/edit.vue.tt +1 -6
  29. data/lib/generators/inertia_tw_templates/scaffold/templates/vue/index.ts.vue.tt +4 -4
  30. data/lib/generators/inertia_tw_templates/scaffold/templates/vue/index.vue.tt +4 -4
  31. data/lib/generators/inertia_tw_templates/scaffold/templates/vue/new.ts.vue.tt +1 -1
  32. data/lib/generators/inertia_tw_templates/scaffold/templates/vue/new.vue.tt +1 -1
  33. data/lib/generators/inertia_tw_templates/scaffold/templates/vue/show.ts.vue.tt +4 -4
  34. data/lib/generators/inertia_tw_templates/scaffold/templates/vue/show.vue.tt +4 -4
  35. data/lib/inertia_rails/big_integers.rb +23 -0
  36. data/lib/inertia_rails/configuration.rb +53 -0
  37. data/lib/inertia_rails/controller.rb +51 -14
  38. data/lib/inertia_rails/devtools/body_capture.rb +102 -0
  39. data/lib/inertia_rails/devtools/collector.rb +133 -0
  40. data/lib/inertia_rails/devtools/config.rb +64 -0
  41. data/lib/inertia_rails/devtools/entry_builder.rb +97 -0
  42. data/lib/inertia_rails/devtools/entry_store.rb +122 -0
  43. data/lib/inertia_rails/devtools/middleware.rb +43 -0
  44. data/lib/inertia_rails/devtools/prop_classifier.rb +62 -0
  45. data/lib/inertia_rails/devtools/recorder.rb +157 -0
  46. data/lib/inertia_rails/devtools/redaction.rb +93 -0
  47. data/lib/inertia_rails/devtools/route_locator.rb +49 -0
  48. data/lib/inertia_rails/devtools/source_locator.rb +94 -0
  49. data/lib/inertia_rails/devtools.rb +52 -0
  50. data/lib/inertia_rails/engine.rb +19 -0
  51. data/lib/inertia_rails/errors.rb +0 -6
  52. data/lib/inertia_rails/helper.rb +37 -17
  53. data/lib/inertia_rails/meta_tag.rb +6 -4
  54. data/lib/inertia_rails/meta_tag_builder.rb +5 -2
  55. data/lib/inertia_rails/middleware.rb +85 -16
  56. data/lib/inertia_rails/minitest.rb +8 -0
  57. data/lib/inertia_rails/precognition.rb +2 -1
  58. data/lib/inertia_rails/prop_cacheable.rb +20 -3
  59. data/lib/inertia_rails/prop_evaluator.rb +2 -3
  60. data/lib/inertia_rails/prop_mergeable.rb +6 -0
  61. data/lib/inertia_rails/props_resolver.rb +75 -20
  62. data/lib/inertia_rails/renderer.rb +108 -37
  63. data/lib/inertia_rails/rspec.rb +8 -0
  64. data/lib/inertia_rails/scroll_prop.rb +5 -7
  65. data/lib/inertia_rails/ssr_renderer.rb +54 -20
  66. data/lib/inertia_rails/testing.rb +16 -1
  67. data/lib/inertia_rails/version.rb +1 -1
  68. data/lib/inertia_rails.rb +4 -0
  69. data/lib/puma/plugin/inertia_ssr.rb +13 -12
  70. metadata +15 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4e9384ee4e756ec30efcbb0afa77c7d557d02dd4d5dc60f1dc6239ec1d0b1878
4
- data.tar.gz: 98e207f798ae91e888f1de274caa506bbc289ac51ea2e20e2eb5465f818575fd
3
+ metadata.gz: f12c422cd3da5a02e05eabd6c2dd2e8a702024709f1e9cebf7050d5d21af5492
4
+ data.tar.gz: cb131811d666ee1db0f4974cfdf18ec1f692584d5bbc250f77b1498d771ac4a0
5
5
  SHA512:
6
- metadata.gz: 6d9dd387eb80c39743d7d48268ef7540710a27194c52f165e4f75565fd4e76cc151db286b64b5e050fa387027b80a0eb3b37210908068a826cfedfe6003aea67
7
- data.tar.gz: 3309e07158894db2e60b03c15e0f46b8d056e09821487412709b738a5ceeb2508c54d5df7421ad77ee04e30a2592e8a07a48de720192446ad5290e18c423eb47
6
+ metadata.gz: 4e846a1e5c73767b155d5087c2cdb2af0e06c0cf489387ac253cc647b8da1c0d56ec5edbb7fa33364b6ed391074422cd4735b7bd10668e44b9efc9e482032ede
7
+ data.tar.gz: 27e2d1c62868602a4408372e932f3549631cc92c08e5b10583fad67f04e456e21dd22e3821de0904423b38c8ab785cc5364d7916d18bd42f5801ea6f1dfd799c
data/CHANGELOG.md CHANGED
@@ -6,6 +6,48 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [3.23.0] - 2026-10-16
10
+
11
+ * Accept a block in `inertia_ssr_head` for fallback head elements, rendered when the response isn't server-side rendered, like inertia-laravel's `<x-inertia::head>` (@skryukov)
12
+ * Add `config.convert_fragment_redirects` (off by default and enabled by the installer, requires Inertia.js v3) to keep URL fragments on Inertia redirects: a same-origin redirect to a URL with a fragment becomes a `409` response with the `X-Inertia-Redirect` header, which the client follows with a regular Inertia visit (@skryukov)
13
+ * Add the `preserve_big_integers` option (config, `inertia_config` and render option), which sends integers outside JavaScript's safe range as `{"$bigint": "..."}` markers that Inertia.js v3.8+ turns into `BigInt` values. The testing helpers turn them back into integers (@skryukov)
14
+ * Leave `encryptHistory` and `clearHistory` out of the page object when they are `false`, like inertia-laravel 3.x. Clients treat a missing key as `false`; specs that compare the full page JSON need updating (@skryukov)
15
+ * Always escape the initial page JSON in the `<script>` element instead of relying on `ActiveSupport.escape_html_entities_in_json` being on. With that setting off, a prop containing `</script>` could break out of the element (@skryukov)
16
+ * Add `config.ssr_timeout` (default 10 seconds) for SSR requests, instead of `Net::HTTP`'s 60 seconds, so a stuck SSR server can't hold a request for a minute (@skryukov)
17
+ * Fix SSR failing with a 500 when `ssr_url` ends with a slash (@skryukov)
18
+ * Send `X-Inertia-Version` with the stale-version `409` response, so Inertia.js v3.6+ can skip the reload on background requests such as polling (@skryukov)
19
+ * Keep flash messages when a stale asset version forces a page refresh, instead of losing them (@skryukov)
20
+ * Fix dot-notated prop keys (`'auth.user' => ...`) passed to `render` or `inertia_share` reaching the client as a literal key instead of nested props (@skryukov)
21
+ * Fix an app's `rescue_from StandardError` turning Precognition validation responses into error pages. `InertiaRails::PrecognitionResponse` now inherits from `Exception`, so bare `rescue` clauses and `Rails.error.handle` no longer swallow it either; code that caught it as a `StandardError` must rescue it by name (@skryukov)
22
+ * Add `Precognition` to the `Vary` header of responses from actions that call `precognition!` or `precognition`, like Laravel, so HTTP caches keep validation responses apart from regular ones (@skryukov)
23
+ * Fix `InertiaRails.scroll` merge metadata ignoring the infinite scroll merge intent since 3.19.0: loading the previous page appended its items instead of prepending them, and a `wrapper:` prop replaced the loaded items instead of merging into the wrapped key. A scroll prop shared via `inertia_share` no longer collects duplicate merge paths on every request (@skryukov)
24
+ * Fix once props missing from partial reloads that only list `except`: the client's already-loaded once props are skipped on full visits only, as in inertia-laravel (@skryukov)
25
+ * Skip `to_inertia` for objects a partial reload doesn't include, instead of serializing them and dropping the result (@skryukov)
26
+ * Expose `@_inertia_page` to views on SSR responses (@onk)
27
+ * Add [Inertia DevTools](https://inertiajs.com/docs/v3/advanced/devtools) support: record requests in development (or those `config.devtools.authorize` approves elsewhere), expose the read API the browser extension reads, and configure it under `config.devtools` (@mattwigham and @skryukov)
28
+ * Accept an object that responds to `to_inertia` as `props:`, as prop values already were. With `inertia_prop_sources`, it can also tell DevTools where it declared each prop (@skryukov)
29
+ * Fix `to_inertia` objects returned from a closure or a prop type's block, placed in an array, or returned from an `InertiaRails.cache` block being serialized with `as_json`, which sent the object's instance variables, such as the record it wraps, to the client. Cached prop keys move to `inertia_rails/@2/`, so entries written before this fix are never read again: every cached prop fills once after upgrading, and code that deletes cached props by their full key needs the new prefix. `ActiveSupport::OrderedOptions` is no longer mistaken for a serializer, which turned it into `null` (@skryukov)
30
+ * Add testing helpers for scroll props and once props (@onk)
31
+ * Skip the `XSRF-TOKEN` cookie entirely (and expire a stale one) on controllers using Rails 8.2's `:header_only` forgery protection strategy, which verifies requests via `Sec-Fetch-Site` and never reads authenticity tokens (@mattwigham)
32
+ * Skip setting `XSRF-TOKEN` cookie when Rails 8.2's `:header_only` CSRF strategy is on (@mattwigham)
33
+ * Add `config.server_head` to serialize meta tags as HTML strings into the `head` prop for the `serverHead` option of `createInertiaApp` (Inertia.js v3.5+), replacing the client-side cookbook component (@skryukov)
34
+ * Add `meta_title_template` configuration option — a callable applied to the `<title>` tag of server driven meta tags; it receives the current title (or `nil`) and can provide a default for pages without one (@skryukov)
35
+ * Add `ActiveSupport::Notifications` instrumentation: `render.inertia_rails`, `resolve_props.inertia_rails`, and `ssr.inertia_rails` events (@skryukov)
36
+ * Report SSR failures to the Rails error reporter (`source: "inertia_rails"`, `handled: true`) with the component, error type, hint, JS stack, and source location as context; skipped when `on_ssr_error` is configured or `ssr_raise_on_error` is enabled (@bknoles)
37
+ * Preserve the original exception as `cause` on `InertiaRails::SSRError`, so connection failures report the underlying error instead of only the wrapper (@bknoles)
38
+ * Convert external (cross-origin) redirects to Inertia location responses automatically (disable with `config.convert_external_redirects = false`), and add `redirect_to url, inertia: { full_page: true }` for same-origin redirects to non-Inertia endpoints (@skryukov)
39
+ * Fix `inertia_location` to redirect plain (non-Inertia) requests instead of responding `409 Conflict`, and stop stale asset versions from replacing location responses with a forced refresh (@skryukov)
40
+ * Fix partial reloads addressing array elements by index (`only: ['rows.0.name']`) dropping the elements they did not name, which shifted every later element onto the wrong path. Unrequested elements now keep their slot as a placeholder (`{}` for an element written as a Hash, `null` otherwise) and are never evaluated, and an indexed `only`/`except` path is now applied to arrays of plain hashes too (@skryukov)
41
+ * Fix meta tags ignoring per-controller `use_data_inertia_head_attribute` set via `inertia_config` (@skryukov)
42
+ * Use SHA256 instead of MD5 for generated meta tag head keys (@skryukov)
43
+ * Restart the SSR server promptly in the Puma plugin when the process dies during boot, instead of polling a dead port for the full boot timeout (@skryukov)
44
+ * Fix `NoMethodError` raised when a request carrying the `X-Inertia` header reaches a non-Inertia controller such as an `ActionController::API` endpoint (@SAY-5)
45
+ * Fix stale flash notice and use idiomatic class in Vue scaffolds (@skryukov)
46
+ * Start the SSR server in the Puma plugin regardless of the global `ssr_enabled`, so SSR enabled per controller with `inertia_config` works (@bknoles)
47
+ * Add lefthook with pre-commit and pre-push hooks that mirror CI/CD checks (@bknoles)
48
+ * Add `default_title:` option to `inertia_meta_tags`, and render meta tags in the installer's layout instead of a plain `<title>` (@bknoles)
49
+ * Use `PATCH` instead of a method override header in scaffold edit forms with file uploads (@skryukov)
50
+
9
51
  ## [3.22.0] - 2026-07-17
10
52
 
11
53
  * Only set the `XSRF-TOKEN` cookie on HTML and XHR responses. Other responses no longer carry a `Set-Cookie` that keeps CDNs from caching them — notably ActiveStorage's images, since its controllers also inherit from `ActionController::Base` (@acetinick)
data/README.md CHANGED
@@ -98,6 +98,7 @@ Full walkthrough: **[Server-side setup](https://inertia-rails.dev/guide/server-s
98
98
  | **[Deferred props](https://inertia-rails.dev/guide/deferred-props)** | Load the page fast, fetch expensive data after, with built-in loading states. |
99
99
  | **[Rails generators](https://inertia-rails.dev/guide/server-side-setup)** | Scaffold entire CRUD interfaces — controllers with matching components. |
100
100
  | **[History encryption](https://inertia-rails.dev/guide/history-encryption)** | Keep sensitive data private, even in browser history. Toggle per page. |
101
+ | **[DevTools](https://inertia-rails.dev/guide/devtools)** | Inspect every request's props, headers, and route in your browser's DevTools (Chrome or Firefox). On by default in development. |
101
102
 
102
103
  ## Why Inertia?
103
104
 
@@ -126,6 +127,7 @@ Everything lives at **[inertia-rails.dev](https://inertia-rails.dev)**:
126
127
  - [Shared data](https://inertia-rails.dev/guide/shared-data) · [Partial reloads](https://inertia-rails.dev/guide/partial-reloads) · [Deferred props](https://inertia-rails.dev/guide/deferred-props)
127
128
  - [Server-side rendering](https://inertia-rails.dev/guide/server-side-rendering)
128
129
  - [Testing](https://inertia-rails.dev/guide/testing)
130
+ - [DevTools](https://inertia-rails.dev/guide/devtools)
129
131
  - [Configuration reference](https://inertia-rails.dev/guide/configuration)
130
132
 
131
133
  ## Community
@@ -136,10 +138,16 @@ Everything lives at **[inertia-rails.dev](https://inertia-rails.dev)**:
136
138
 
137
139
  ## Contributing
138
140
 
139
- Bug reports and pull requests are welcome. To run the test suite:
141
+ Bug reports and pull requests are welcome. To set up your environment (this
142
+ also installs [lefthook](https://lefthook.dev) git hooks that mirror our CI checks):
143
+
144
+ ```bash
145
+ bin/setup
146
+ ```
147
+
148
+ To run the test suite:
140
149
 
141
150
  ```bash
142
- bundle install
143
151
  bundle exec rspec
144
152
  ```
145
153
 
@@ -150,6 +158,6 @@ project is expected to follow it.
150
158
 
151
159
  Inertia Rails is part of the official [Inertia.js](https://inertiajs.com)
152
160
  organization. It was originally created by the team at
153
- [bellaWatt](https://bellawatt.com) and is maintained by the Inertia.js community.
161
+ [Bellawatt](https://bellawatt.com) and is maintained by the Inertia.js community.
154
162
 
155
163
  Released under the [MIT License](LICENSE.txt).
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ module InertiaRails
4
+ module Devtools
5
+ class EntriesController < Devtools.config.base_controller.constantize
6
+ prepend_before_action :skip_session_write
7
+ before_action :authorize_devtools_access
8
+
9
+ def index
10
+ entries = Devtools.store.list(
11
+ component: params[:component].presence,
12
+ types: list_param(:type),
13
+ exclude: list_param(:exclude),
14
+ offset: Integer(params[:offset], 10, exception: false),
15
+ limit: Integer(params[:limit], 10, exception: false)
16
+ )
17
+
18
+ render json: entries
19
+ end
20
+
21
+ def show
22
+ entry = Devtools.store.read(params[:id])
23
+ return head :not_found if entry.blank?
24
+
25
+ render json: entry
26
+ end
27
+
28
+ private
29
+
30
+ def skip_session_write
31
+ request.session_options[:skip] = true if request.session_options
32
+ end
33
+
34
+ def authorize_devtools_access
35
+ head :forbidden unless Devtools.config.allows?(self)
36
+ end
37
+
38
+ def list_param(name)
39
+ params[name].to_s.split(',').map(&:strip).reject(&:empty?)
40
+ end
41
+ end
42
+ end
43
+ end
@@ -103,7 +103,13 @@ module Inertia
103
103
  end
104
104
 
105
105
  say "Copying #{inertia_entrypoint} entrypoint"
106
- copy_file "#{framework}/#{inertia_entrypoint}", js_file_path("entrypoints/#{inertia_entrypoint}")
106
+ entrypoint_path = js_file_path("entrypoints/#{inertia_entrypoint}")
107
+ copy_file "#{framework}/#{inertia_entrypoint}", entrypoint_path
108
+ # The Svelte adapter ignores the title callback.
109
+ unless svelte?
110
+ insert_into_file entrypoint_path, "\n title: (title) => title || #{app_title.to_json},\n",
111
+ after: "serverHead: true,\n"
112
+ end
107
113
 
108
114
  # Copy framework-specific config files
109
115
  if svelte?
@@ -128,11 +134,12 @@ module Inertia
128
134
  before: '<%= vite_client_tag %>'
129
135
  end
130
136
 
131
- gsub_file application_layout.to_s, /<title>/, '<title data-inertia>' unless svelte?
137
+ say 'Replacing the <title> tag with the inertia_meta_tags helper in the application layout'
138
+ gsub_file application_layout.to_s, %r{^(\s*)<title>.*</title>\s*\n}, "\\1#{inertia_meta_tags_line}\n"
132
139
  else
133
140
  say_error 'Could not find the application layout file. Please add the following tags manually:', :red
134
141
  say_error '- <title>...</title>'
135
- say_error '+ <title data-inertia>...</title>'
142
+ say_error "+ #{inertia_meta_tags_line}"
136
143
  say_error '+ <%= inertia_ssr_head %>'
137
144
  say_error '+ <%= vite_react_refresh_tag %>' if react?
138
145
  say_error "+ <%= #{vite_tag} %>"
@@ -337,6 +344,14 @@ module Inertia
337
344
  options[:verbose]
338
345
  end
339
346
 
347
+ def inertia_meta_tags_line
348
+ "<%= inertia_meta_tags(default_title: content_for(:title) || #{app_title.inspect}) %>"
349
+ end
350
+
351
+ def app_title
352
+ Rails.application.class.module_parent_name.titleize
353
+ end
354
+
340
355
  def svelte?
341
356
  framework.start_with? 'svelte'
342
357
  end
@@ -6,4 +6,6 @@ InertiaRails.configure do |config|
6
6
  config.always_include_errors_hash = true
7
7
  config.use_script_element_for_initial_page = true
8
8
  config.use_data_inertia_head_attribute = true
9
+ config.server_head = true
10
+ config.convert_fragment_redirects = true
9
11
  end
@@ -3,6 +3,8 @@ import { createInertiaApp } from '@inertiajs/react'
3
3
  createInertiaApp({
4
4
  pages: "../pages",
5
5
 
6
+ serverHead: true,
7
+
6
8
  strictMode: true,
7
9
 
8
10
  defaults: {
@@ -3,6 +3,8 @@ import { createInertiaApp } from '@inertiajs/react'
3
3
  void createInertiaApp({
4
4
  pages: "../pages",
5
5
 
6
+ serverHead: true,
7
+
6
8
  strictMode: true,
7
9
 
8
10
  defaults: {
@@ -3,6 +3,8 @@ import { createInertiaApp } from '@inertiajs/svelte'
3
3
  createInertiaApp({
4
4
  pages: "../pages",
5
5
 
6
+ serverHead: true,
7
+
6
8
  defaults: {
7
9
  form: {
8
10
  forceIndicesArrayFormatInFormData: false,
@@ -3,6 +3,8 @@ import { createInertiaApp } from '@inertiajs/svelte'
3
3
  createInertiaApp({
4
4
  pages: "../pages",
5
5
 
6
+ serverHead: true,
7
+
6
8
  defaults: {
7
9
  form: {
8
10
  forceIndicesArrayFormatInFormData: false,
@@ -3,6 +3,8 @@ import { createInertiaApp } from '@inertiajs/vue3'
3
3
  createInertiaApp({
4
4
  pages: "../pages",
5
5
 
6
+ serverHead: true,
7
+
6
8
  defaults: {
7
9
  form: {
8
10
  forceIndicesArrayFormatInFormData: false,
@@ -3,6 +3,8 @@ import { createInertiaApp } from '@inertiajs/vue3'
3
3
  createInertiaApp({
4
4
  pages: "../pages",
5
5
 
6
+ serverHead: true,
7
+
6
8
  defaults: {
7
9
  form: {
8
10
  forceIndicesArrayFormatInFormData: false,
@@ -11,12 +11,7 @@ export default function Edit({ <%= singular_table_name %> }) {
11
11
  <Form
12
12
  <%= singular_table_name %>={<%= singular_table_name %>}
13
13
  action={`<%= js_resource_path %>`}
14
- <% if attributes.any?(&:attachments?) -%>
15
- method="post"
16
- headers={{ 'X-HTTP-METHOD-OVERRIDE': 'patch' }}
17
- <% else -%>
18
14
  method="patch"
19
- <% end -%>
20
15
  submitText="Update <%= human_name %>"
21
16
  />
22
17
 
@@ -17,12 +17,7 @@ export default function Edit({ <%= singular_table_name %> }: EditProps) {
17
17
  <Form
18
18
  <%= singular_table_name %>={<%= singular_table_name %>}
19
19
  action={`<%= js_resource_path %>`}
20
- <% if attributes.any?(&:attachments?) -%>
21
- method="post"
22
- headers={{ 'X-HTTP-METHOD-OVERRIDE': 'patch' }}
23
- <% else -%>
24
20
  method="patch"
25
- <% end -%>
26
21
  submitText="Update <%= human_name %>"
27
22
  />
28
23
 
@@ -16,12 +16,7 @@
16
16
  {<%= singular_table_name %>}
17
17
  submitText="Update <%= human_name %>"
18
18
  action={`<%= js_resource_path %>`}
19
- <% if attributes.any?(&:attachments?) -%>
20
- method="post"
21
- headers={{ 'X-HTTP-METHOD-OVERRIDE': 'patch' }}
22
- <% else -%>
23
19
  method="patch"
24
- <% end -%>
25
20
  />
26
21
 
27
22
  <br />
@@ -17,12 +17,7 @@
17
17
  {<%= singular_table_name %>}
18
18
  submitText="Update <%= human_name %>"
19
19
  action={`<%= js_resource_path %>`}
20
- <% if attributes.any?(&:attachments?) -%>
21
- method="post"
22
- headers={{ 'X-HTTP-METHOD-OVERRIDE': 'patch' }}
23
- <% else -%>
24
20
  method="patch"
25
- <% end -%>
26
21
  />
27
22
 
28
23
  <br />
@@ -7,12 +7,7 @@
7
7
  :<%= singular_table_name %>="<%= singular_table_name %>"
8
8
  submitText="Update <%= human_name %>"
9
9
  :action="`<%= js_resource_path %>`"
10
- <% if attributes.any?(&:attachments?) -%>
11
- method="post"
12
- :headers="{ 'X-HTTP-METHOD-OVERRIDE': 'patch' }"
13
- <% else -%>
14
10
  method="patch"
15
- <% end -%>
16
11
  />
17
12
 
18
13
  <br />
@@ -7,12 +7,7 @@
7
7
  :<%= singular_table_name %>="<%= singular_table_name %>"
8
8
  submitText="Update <%= human_name %>"
9
9
  :action="`<%= js_resource_path %>`"
10
- <% if attributes.any?(&:attachments?) -%>
11
- method="post"
12
- :headers="{ 'X-HTTP-METHOD-OVERRIDE': 'patch' }"
13
- <% else -%>
14
10
  method="patch"
15
- <% end -%>
16
11
  />
17
12
 
18
13
  <br />
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <Head title="<%= human_name.pluralize %>" />
3
3
 
4
- <p v-if="flash.notice" class="notice">{{ flash.notice }}</p>
4
+ <p v-if="page.flash.notice" class="notice">{{ page.flash.notice }}</p>
5
5
 
6
6
  <h1><%= human_name.pluralize %></h1>
7
7
 
@@ -25,7 +25,7 @@ import { <%= inertia_model_type %> } from './types'
25
25
  defineProps<{
26
26
  <%= plural_table_name %>: <%= inertia_model_type %>[]
27
27
  }>()
28
- const { flash } = usePage()
28
+ const page = usePage()
29
29
  </script>
30
30
 
31
31
  <style scoped>
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <Head title="<%= human_name.pluralize %>" />
3
3
 
4
- <p v-if="flash.notice" class="notice">{{ flash.notice }}</p>
4
+ <p v-if="page.flash.notice" class="notice">{{ page.flash.notice }}</p>
5
5
 
6
6
  <h1><%= human_name.pluralize %></h1>
7
7
 
@@ -22,7 +22,7 @@ import { Head, Link, usePage } from '@inertiajs/vue3'
22
22
  import <%= inertia_component_name %> from './<%= singular_name %>.vue'
23
23
 
24
24
  defineProps(['<%= plural_table_name %>'])
25
- const { flash } = usePage()
25
+ const page = usePage()
26
26
  </script>
27
27
 
28
28
  <style scoped>
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <Head :title="`<%= human_name %> #${<%= singular_table_name %>.id}`" />
3
3
 
4
- <p v-if="flash.notice" class="notice">{{ flash.notice }}</p>
4
+ <p v-if="page.flash.notice" class="notice">{{ page.flash.notice }}</p>
5
5
 
6
6
  <h1><%= human_name %> #{{ <%= singular_table_name %>.id }}</h1>
7
7
 
@@ -31,7 +31,7 @@ import { <%= inertia_model_type %> } from './types'
31
31
  defineProps<{
32
32
  <%= singular_table_name %>: <%= inertia_model_type %>
33
33
  }>()
34
- const { flash } = usePage()
34
+ const page = usePage()
35
35
  </script>
36
36
 
37
37
  <style scoped>
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <Head :title="`<%= human_name %> #${<%= singular_table_name %>.id}`" />
3
3
 
4
- <p v-if="flash.notice" class="notice">{{ flash.notice }}</p>
4
+ <p v-if="page.flash.notice" class="notice">{{ page.flash.notice }}</p>
5
5
 
6
6
  <h1><%= human_name %> #{{ <%= singular_table_name %>.id }}</h1>
7
7
 
@@ -28,7 +28,7 @@ import { Head, Link, usePage } from '@inertiajs/vue3'
28
28
  import <%= inertia_component_name %> from './<%= singular_name %>.vue'
29
29
 
30
30
  defineProps(['<%= singular_table_name %>'])
31
- const { flash } = usePage()
31
+ const page = usePage()
32
32
  </script>
33
33
 
34
34
  <style scoped>
@@ -12,12 +12,7 @@ export default function Edit({ <%= singular_table_name %> }) {
12
12
  <Form
13
13
  <%= singular_table_name %>={<%= singular_table_name %>}
14
14
  action={`<%= js_resource_path %>`}
15
- <% if attributes.any?(&:attachments?) -%>
16
- method="post"
17
- headers={{ 'X-HTTP-METHOD-OVERRIDE': 'patch' }}
18
- <% else -%>
19
15
  method="patch"
20
- <% end -%>
21
16
  submitText="Update <%= human_name %>"
22
17
  />
23
18
 
@@ -17,12 +17,7 @@ export default function Edit({ <%= singular_table_name %> }: EditProps) {
17
17
  <Form
18
18
  <%= singular_table_name %>={<%= singular_table_name %>}
19
19
  action={`<%= js_resource_path %>`}
20
- <% if attributes.any?(&:attachments?) -%>
21
- method="post"
22
- headers={{ 'X-HTTP-METHOD-OVERRIDE': 'patch' }}
23
- <% else -%>
24
20
  method="patch"
25
- <% end -%>
26
21
  submitText="Update <%= human_name %>"
27
22
  />
28
23
 
@@ -17,12 +17,7 @@
17
17
  {<%= singular_table_name %>}
18
18
  submitText="Update <%= human_name %>"
19
19
  action={`<%= js_resource_path %>`}
20
- <% if attributes.any?(&:attachments?) -%>
21
- method="post"
22
- headers={{ 'X-HTTP-METHOD-OVERRIDE': 'patch' }}
23
- <% else -%>
24
20
  method="patch"
25
- <% end -%>
26
21
  />
27
22
 
28
23
  <Link
@@ -18,12 +18,7 @@
18
18
  {<%= singular_table_name %>}
19
19
  submitText="Update <%= human_name %>"
20
20
  action={`<%= js_resource_path %>`}
21
- <% if attributes.any?(&:attachments?) -%>
22
- method="post"
23
- headers={{ 'X-HTTP-METHOD-OVERRIDE': 'patch' }}
24
- <% else -%>
25
21
  method="patch"
26
- <% end -%>
27
22
  />
28
23
 
29
24
  <Link
@@ -1,19 +1,14 @@
1
1
  <template>
2
2
  <Head title="Editing <%= human_name.downcase %>" />
3
3
 
4
- <div className="mx-auto md:w-2/3 w-full px-8 pt-8">
4
+ <div class="mx-auto md:w-2/3 w-full px-8 pt-8">
5
5
  <h1 class="font-bold text-4xl">Editing <%= human_name.downcase %></h1>
6
6
 
7
7
  <Form
8
8
  :<%= singular_table_name %>="<%= singular_table_name %>"
9
9
  submitText="Update <%= human_name %>"
10
10
  :action="`<%= js_resource_path %>`"
11
- <% if attributes.any?(&:attachments?) -%>
12
- method="post"
13
- :headers="{ 'X-HTTP-METHOD-OVERRIDE': 'patch' }"
14
- <% else -%>
15
11
  method="patch"
16
- <% end -%>
17
12
  />
18
13
 
19
14
  <Link
@@ -1,19 +1,14 @@
1
1
  <template>
2
2
  <Head title="Editing <%= human_name.downcase %>" />
3
3
 
4
- <div className="mx-auto md:w-2/3 w-full px-8 pt-8">
4
+ <div class="mx-auto md:w-2/3 w-full px-8 pt-8">
5
5
  <h1 class="font-bold text-4xl">Editing <%= human_name.downcase %></h1>
6
6
 
7
7
  <Form
8
8
  :<%= singular_table_name %>="<%= singular_table_name %>"
9
9
  submitText="Update <%= human_name %>"
10
10
  :action="`<%= js_resource_path %>`"
11
- <% if attributes.any?(&:attachments?) -%>
12
- method="post"
13
- :headers="{ 'X-HTTP-METHOD-OVERRIDE': 'patch' }"
14
- <% else -%>
15
11
  method="patch"
16
- <% end -%>
17
12
  />
18
13
 
19
14
  <Link
@@ -1,12 +1,12 @@
1
1
  <template>
2
2
  <Head title="<%= human_name.pluralize %>" />
3
3
 
4
- <div className="mx-auto md:w-2/3 w-full px-8 pt-8">
4
+ <div class="mx-auto md:w-2/3 w-full px-8 pt-8">
5
5
  <p
6
- v-if="flash.notice"
6
+ v-if="page.flash.notice"
7
7
  class="py-2 px-3 bg-green-50 mb-5 text-green-500 font-medium rounded-lg inline-block"
8
8
  >
9
- {{ flash.notice }}
9
+ {{ page.flash.notice }}
10
10
  </p>
11
11
 
12
12
  <div class="flex justify-between items-center">
@@ -43,5 +43,5 @@ import { <%= inertia_model_type %> } from './types'
43
43
  defineProps<{
44
44
  <%= plural_table_name %>: <%= inertia_model_type %>[]
45
45
  }>()
46
- const { flash } = usePage()
46
+ const page = usePage()
47
47
  </script>
@@ -1,12 +1,12 @@
1
1
  <template>
2
2
  <Head title="<%= human_name.pluralize %>" />
3
3
 
4
- <div className="mx-auto md:w-2/3 w-full px-8 pt-8">
4
+ <div class="mx-auto md:w-2/3 w-full px-8 pt-8">
5
5
  <p
6
- v-if="flash.notice"
6
+ v-if="page.flash.notice"
7
7
  class="py-2 px-3 bg-green-50 mb-5 text-green-500 font-medium rounded-lg inline-block"
8
8
  >
9
- {{ flash.notice }}
9
+ {{ page.flash.notice }}
10
10
  </p>
11
11
 
12
12
  <div class="flex justify-between items-center">
@@ -40,5 +40,5 @@ import { Head, Link, usePage } from '@inertiajs/vue3'
40
40
  import <%= inertia_component_name %> from './<%= singular_name %>.vue'
41
41
 
42
42
  defineProps(['<%= plural_table_name %>'])
43
- const { flash } = usePage()
43
+ const page = usePage()
44
44
  </script>
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <Head title="New <%= human_name.downcase %>" />
3
3
 
4
- <div className="mx-auto md:w-2/3 w-full px-8 pt-8">
4
+ <div class="mx-auto md:w-2/3 w-full px-8 pt-8">
5
5
  <h1 class="font-bold text-4xl">New <%= human_name.downcase %></h1>
6
6
 
7
7
  <Form
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <Head title="New <%= human_name.downcase %>" />
3
3
 
4
- <div className="mx-auto md:w-2/3 w-full px-8 pt-8">
4
+ <div class="mx-auto md:w-2/3 w-full px-8 pt-8">
5
5
  <h1 class="font-bold text-4xl">New <%= human_name.downcase %></h1>
6
6
 
7
7
  <Form
@@ -1,13 +1,13 @@
1
1
  <template>
2
2
  <Head :title="`<%= human_name %> #${<%= singular_table_name %>.id}`" />
3
3
 
4
- <div className="mx-auto md:w-2/3 w-full px-8 pt-8">
4
+ <div class="mx-auto md:w-2/3 w-full px-8 pt-8">
5
5
  <div class="mx-auto">
6
6
  <p
7
- v-if="flash.notice"
7
+ v-if="page.flash.notice"
8
8
  class="py-2 px-3 bg-green-50 mb-5 text-green-500 font-medium rounded-lg inline-block"
9
9
  >
10
- {{ flash.notice }}
10
+ {{ page.flash.notice }}
11
11
  </p>
12
12
 
13
13
  <h1 class="font-bold text-4xl"><%= human_name %> #{{ <%= singular_table_name %>.id }}</h1>
@@ -49,5 +49,5 @@ import { <%= inertia_model_type %> } from './types'
49
49
  defineProps<{
50
50
  <%= singular_table_name %>: <%= inertia_model_type %>
51
51
  }>()
52
- const { flash } = usePage()
52
+ const page = usePage()
53
53
  </script>
@@ -1,13 +1,13 @@
1
1
  <template>
2
2
  <Head :title="`<%= human_name %> #${<%= singular_table_name %>.id}`" />
3
3
 
4
- <div className="mx-auto md:w-2/3 w-full px-8 pt-8">
4
+ <div class="mx-auto md:w-2/3 w-full px-8 pt-8">
5
5
  <div class="mx-auto">
6
6
  <p
7
- v-if="flash.notice"
7
+ v-if="page.flash.notice"
8
8
  class="py-2 px-3 bg-green-50 mb-5 text-green-500 font-medium rounded-lg inline-block"
9
9
  >
10
- {{ flash.notice }}
10
+ {{ page.flash.notice }}
11
11
  </p>
12
12
 
13
13
  <h1 class="font-bold text-4xl"><%= human_name %> #{{ <%= singular_table_name %>.id }}</h1>
@@ -46,5 +46,5 @@ import { Head, Link, usePage } from '@inertiajs/vue3'
46
46
  import <%= inertia_component_name %> from './<%= singular_name %>.vue'
47
47
 
48
48
  defineProps(['<%= singular_table_name %>'])
49
- const { flash } = usePage()
49
+ const page = usePage()
50
50
  </script>