diff --git a/lib/simple_form/wrappers/single.rb b/lib/simple_form/wrappers/single.rb index 77a6daf3..bc5e82c1 100644 --- a/lib/simple_form/wrappers/single.rb +++ b/lib/simple_form/wrappers/single.rb @@ -3,23 +3,21 @@ module SimpleForm # `Single` is an optimization for a wrapper that has only one component. class Single < Many def initialize(name, wrapper_options = {}, options = {}) - super(name, [Leaf.new(name, options)], wrapper_options) + @component = Leaf.new(name, options) + + super(name, [@component], wrapper_options) end def render(input) options = input.options if options[namespace] != false - content = component.render(input) + content = @component.render(input) wrap(input, options, content) if content end end private - def component - components.first - end - def html_options(options) [:label, :input].include?(namespace) ? {} : super end