Skip to content

Commit 0f72cbf

Browse files
committed
Fixing error when label_html doesn't exist
1 parent e6a0686 commit 0f72cbf

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,11 @@ Readers.
8787
### Horizontal Forms
8888

8989
To use a horizontal-style form with labels to the left of the inputs,
90-
use the `style: :horizontal` option. You can specify both `left` and
91-
`right` css classes as well, which default to `col-sm-2` and `col-sm-10`.
90+
use the `style: :horizontal` option. You should specify both `left` and
91+
`right` css classes as well (they default to `col-sm-2` and `col-sm-10`).
9292

9393
```erb
94-
<%= bootstrap_form_for(@user, style: horizontal, left: "col-sm-2", right: "col-sm-10") do |f| %>
94+
<%= bootstrap_form_for(@user, style: :horizontal, left: "col-sm-2", right: "col-sm-10") do |f| %>
9595
<%= f.email_field :email %>
9696
<%= f.password_field :password %>
9797

lib/bootstrap_form/form_builder.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def initialize(object_name, object, template, options, proc=nil)
2020

2121
label = options.delete(:label)
2222
label_class = options.delete(:label_class)
23-
help = options.delete(:help)
23+
help = options.delete(:help)
2424

2525
form_group(name, label: { text: label, class: label_class }, help: help) do
2626
options[:class] = "form-control #{options[:class]}".rstrip
@@ -80,7 +80,7 @@ def form_group(name = nil, options = {}, &block)
8080
label_html = if label_options
8181
label_options[:class] = "#{@left_class} control-label".lstrip if @style == :horizontal
8282
label(name, label_options[:text], label_options.except(:text))
83-
end
83+
end || ""
8484

8585
html = capture(&block)
8686

0 commit comments

Comments
 (0)