Sha256: 7c812b38cc6d43bc93717be7414b5d63d60f1d5f0c0745e5a4bd0ac4a29035f4

Contents?: true

Size: 687 Bytes

Versions: 6

Compression:

Stored size: 687 Bytes

Contents

module DynamicScaffold
  module Form
    module Item
      class SingleOption < Base
        def initialize(config, type, *args)
          name = args.shift
          html_attributes = args.extract_options!
          @args = args
          super(config, type, name, html_attributes)
        end

        def render(view, form, classnames = nil)
          html_attributes = build_html_attributes(classnames)
          # Retain the value of the password field on error.
          html_attributes[:value] = form.object.public_send(@name) if @type == :password_field
          form.public_send(@type, @name, *build_args(view, @args), html_attributes)
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
dynamic_scaffold-1.12.2 lib/dynamic_scaffold/form/item/single_option.rb
dynamic_scaffold-1.12.1 lib/dynamic_scaffold/form/item/single_option.rb
dynamic_scaffold-1.12.0 lib/dynamic_scaffold/form/item/single_option.rb
dynamic_scaffold-1.11.0 lib/dynamic_scaffold/form/item/single_option.rb
dynamic_scaffold-1.10.0 lib/dynamic_scaffold/form/item/single_option.rb
dynamic_scaffold-1.9.0 lib/dynamic_scaffold/form/item/single_option.rb