diff options
author | Robin Dupret <robin.dupret@gmail.com> | 2015-01-31 18:38:33 +0100 |
---|---|---|
committer | Robin Dupret <robin.dupret@gmail.com> | 2015-01-31 18:38:33 +0100 |
commit | 34e562b0b71752c44ea0dac36325d3af6ec07c16 (patch) | |
tree | 98bcac9b893ab1d770a56cadddfef5e26d3cfa96 /guides | |
parent | 34c2da319dd79e973a9006af262699fefe4fd094 (diff) | |
parent | 8c976c3843481d17d35d5f506c3d94483084d689 (diff) | |
download | rails-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.md | 9 |
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 |