Skip to content

Commit fb69f7f

Browse files
committed
use the form buffer!
1 parent 23676cc commit fb69f7f

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

lib/active_admin/filters/forms.rb

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,16 @@ module Filters
55
# as the one found in the sidebar of the index page of a standard resource.
66
class FormBuilder < ::ActiveAdmin::FormBuilder
77

8+
def initialize(*args)
9+
@use_form_buffer = true # force ActiveAdmin::FormBuilder to use the form buffer
10+
super
11+
end
12+
813
def filter(method, options = {})
914
method = method.to_s.sub(/_id\z/,'').to_sym
1015

1116
if method.present? && options[:as] ||= default_input_type(method)
12-
form_buffers.last << input(method, options)
13-
else
14-
''
17+
input(method, options)
1518
end
1619
end
1720

lib/active_admin/form_builder.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ def initialize(*args)
99
end
1010

1111
def inputs(*args, &block)
12-
@inputs_with_block = block_given?
12+
@use_form_buffer = block_given?
1313
form_buffers.last << with_new_form_buffer{ super }
1414
end
1515

1616
# If this `input` call is inside a `inputs` block, add the content
1717
# to the form buffer. Else, return it directly.
1818
def input(method, *args)
1919
content = with_new_form_buffer{ super }
20-
@inputs_with_block ? form_buffers.last << content : content
20+
@use_form_buffer ? form_buffers.last << content : content
2121
end
2222

2323
def cancel_link(url = {:action => "index"}, html_options = {}, li_attrs = {})

0 commit comments

Comments
 (0)