class DynamicScaffold::Form::Item::SingleOption

Public Class Methods

new(config, type, *args) click to toggle source
Calls superclass method DynamicScaffold::Form::Item::Base::new
# File lib/dynamic_scaffold/form/item/single_option.rb, line 5
def initialize(config, type, *args)
  name = args.shift
  html_attributes = args.extract_options!
  @args = args
  super(config, type, name, html_attributes)
end

Public Instance Methods

render(view, form, classnames = nil) click to toggle source
# File lib/dynamic_scaffold/form/item/single_option.rb, line 12
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