Skip to content

Instantly share code, notes, and snippets.

@jroes
Created September 7, 2012 13:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jroes/3666337 to your computer and use it in GitHub Desktop.
Save jroes/3666337 to your computer and use it in GitHub Desktop.
module ActiveAdmin
class FormBuilder < ::Formtastic::FormBuilder
# ...
# The input method returns a properly formatted string for
# its contents, so we want to skip the internal buffering
# while building up its contents
def input(method, *args)
content = with_new_form_buffer { super }
return content.html_safe unless @inputs_with_block
form_buffers.last << content.html_safe
end
# ...
private
def with_new_form_buffer
form_buffers << "".html_safe
return_value = yield
form_buffers.pop
return_value
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment