aboutsummaryrefslogtreecommitdiffstats
path: root/guides
diff options
context:
space:
mode:
authorRobin Dupret <robin.dupret@gmail.com>2015-01-31 18:38:33 +0100
committerRobin Dupret <robin.dupret@gmail.com>2015-01-31 18:38:33 +0100
commit34e562b0b71752c44ea0dac36325d3af6ec07c16 (patch)
tree98bcac9b893ab1d770a56cadddfef5e26d3cfa96 /guides
parent34c2da319dd79e973a9006af262699fefe4fd094 (diff)
parent8c976c3843481d17d35d5f506c3d94483084d689 (diff)
downloadrails-34e562b0b71752c44ea0dac36325d3af6ec07c16.tar.gz
rails-34e562b0b71752c44ea0dac36325d3af6ec07c16.tar.bz2
rails-34e562b0b71752c44ea0dac36325d3af6ec07c16.zip
Merge pull request #18540 from andreynering/guides-custom-form-builder
Improving 'Customizing Form Builder' section with example [ci skip]
Diffstat (limited to 'guides')
-rw-r--r--guides/source/form_helpers.md9
1 files changed, 8 insertions, 1 deletions
diff --git a/guides/source/form_helpers.md b/guides/source/form_helpers.md
index 4c02c99cc7..90004c611b 100644
--- a/guides/source/form_helpers.md
+++ b/guides/source/form_helpers.md
@@ -687,7 +687,14 @@ class LabellingFormBuilder < ActionView::Helpers::FormBuilder
end
```
-If you reuse this frequently you could define a `labeled_form_for` helper that automatically applies the `builder: LabellingFormBuilder` option.
+If you reuse this frequently you could define a `labeled_form_for` helper that automatically applies the `builder: LabellingFormBuilder` option:
+
+```ruby
+def labeled_form_for(record, options = {}, &block)
+ options.merge! builder: LabellingFormBuilder
+ form_for record, options, &block
+end
+```
The form builder used also determines what happens when you do