Skip to content

Instantly share code, notes, and snippets.

View zykadelic's full-sized avatar

Andreas Fransson zykadelic

View GitHub Profile
@zykadelic
zykadelic / default_form_builder.rb
Last active December 24, 2015 13:39 — forked from calvincorreli/set_default_form_builder.rb
Set the default FormBuilder without having to restart the server on each change made to the DefaultFormBuilder class
# in app/helpers
class DefaultFormBuilder < ActionView::Helpers::FormBuilder
# Example of an added method that wraps custom textfields, where type can be
# :email_field, :text_field, etc.
def textfield(type, method, attributes = {})
@template.content_tag :div, class: 'textfield' do
@template.send(type, @object_name, method, objectify_options(attributes))
end
end