turbo_form 0.6.0 → 0.7.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1ea880fbc0453b32344bf09706c5bc68c095de36fdbea018f00fdf4adc7acc03
4
- data.tar.gz: 49bf3d131c1a1179d8ce8b64772e23681f1c54332797bca9cd46589c4d0c90d3
3
+ metadata.gz: aa91aad45adf34a36370bd723ccbd9d1034856f813a435225746fdcc233c82da
4
+ data.tar.gz: 5be9884b622cd2dad8a37be9794a6c0dcf84b98893f4282fa17bd69d55829014
5
5
  SHA512:
6
- metadata.gz: 300aabd3ad77727c57ddf99980ce56036e4f5fdbf6c001a31908dcef1f0f53408b4100cf21fa1b88abfd663f2adab10dd14003d90e1915136231e62576b1e2d6
7
- data.tar.gz: 24ec9eabed896e9de6f14c71b70e3f6aa8bc299244fcf3858146b55bf5d78c76549e4e08acdaaa6c0f77b13b6713183fabc2c469347c3a59df7e7dd477ed6ff9
6
+ metadata.gz: 28cfba558ef2d8151053f282d8a72aa8827857d673f6d23db1917152e7387418a5b22548142d165b01e12cb682634523438a02a1e5c2db4b4d898299b300c7a9
7
+ data.tar.gz: 7c8b0e1ab6a8a2fb1470a34084feffb2762ec25294de20aea270749a4b8541b450dc14ecf89889c4ebf86ad1b45b8959c4ae0a72c4afb4f63a987a11fc7e2b50
data/README.md CHANGED
@@ -133,9 +133,9 @@ For a `WidgetsController`:
133
133
  - `new` and `edit` set `@widget`,
134
134
  - `widget_params` permits the form's fields — the same method `create` and
135
135
  `update` already use, so a trigger assigns nothing a save wouldn't,
136
- - `new` and `edit` leave rendering to Rails. The values are assigned just before
137
- Rails' implicit render, so an action that calls `render` itself renders its
138
- object as it built it, and one that redirects still redirects.
136
+ - `new` and `edit` render their own template, implicitly or with `render`
137
+ themselves — `render layout: 'panel'` is fine. The values are assigned just
138
+ before it renders; an action that redirects still redirects.
139
139
 
140
140
  ### Switching an STI subclass
141
141
 
@@ -1,22 +1,24 @@
1
1
  module TurboForm
2
2
  # Included into the host's ApplicationController. A request that
3
3
  # TurboForm::Routes marks runs `new` or `edit` as usual, callbacks and all,
4
- # then assigns the form to what the action built just before the implicit
5
- # render.
4
+ # then assigns the form to what the action built just before it renders --
5
+ # implicitly, or with its own `render layout: 'panel'`.
6
6
  #
7
- # Leans on the scaffold's conventions: the action builds `@<resource>`,
8
- # `<resource>_params` permits the form, and the action leaves rendering to Rails.
7
+ # Leans on the scaffold's conventions: the action builds `@<resource>` and
8
+ # `<resource>_params` permits the form.
9
9
  module Controller
10
+ # Public, as Rails' own is. ActionController::Base's public methods are never
11
+ # actions, so this one isn't either.
12
+ def render(...)
13
+ dynamic_form_assignment if dynamic_form?
14
+ super
15
+ end
16
+
10
17
  private
11
18
  def process_action(...)
12
19
  dynamic_form? ? discarding_writes { super } : super
13
20
  end
14
21
 
15
- def default_render
16
- dynamic_form_assignment if dynamic_form?
17
- super
18
- end
19
-
20
22
  def dynamic_form_assignment
21
23
  resource = turbo_form_resource.extend(TurboForm::Resource).dynamic_assign(turbo_form_resource_params)
22
24
  instance_variable_set(:"@#{turbo_form_resource_name}", resource)
@@ -1,3 +1,3 @@
1
1
  module TurboForm
2
- VERSION = '0.6.0'
2
+ VERSION = '0.7.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: turbo_form
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Cohen