We were monkey-patching FoundationRailsHelper::Formbuilder, which made form customization difficult. We can inherit from it, which is the standard way of extending what an existing class does, and make our form the default one.
16 lines
466 B
Ruby
16 lines
466 B
Ruby
class ConsulFormBuilder < FoundationRailsHelper::FormBuilder
|
|
def cktext_area(attribute, options)
|
|
field(attribute, options) do |opts|
|
|
super(attribute, opts)
|
|
end
|
|
end
|
|
|
|
def enum_select(attribute, options = {}, html_options = {})
|
|
choices = object.class.send(attribute.to_s.pluralize).keys.map do |name|
|
|
[object.class.human_attribute_name("#{attribute}.#{name}"), name]
|
|
end
|
|
|
|
select attribute, choices, options, html_options
|
|
end
|
|
end
|