diff options
author | Andrey Nering <andrey.nering@gmail.com> | 2015-01-15 15:55:15 -0200 |
---|---|---|
committer | Andrey Nering <andrey.nering@gmail.com> | 2015-01-16 08:22:50 -0200 |
commit | 8c976c3843481d17d35d5f506c3d94483084d689 (patch) | |
tree | 483df6c44cd2a418c94605a8cb72739b25fe8863 /guides | |
parent | 363e298c3cdfc4c3b569d4fe4053edc3b8943f0a (diff) | |
download | rails-8c976c3843481d17d35d5f506c3d94483084d689.tar.gz rails-8c976c3843481d17d35d5f506c3d94483084d689.tar.bz2 rails-8c976c3843481d17d35d5f506c3d94483084d689.zip |
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 |