vendor/plugins/enum-column/lib/enum/active_record_helper.rb
# Creates a set of radio buttons and labels.
Creates a set of radio buttons and labels.
Creates a set of radio buttons and labels .
def to_enum_radio_tag(options = {})
        begin
          v = value(object)
        rescue ArgumentError
          v = value
        end
        add_default_name_and_id(options)
        values = enum_values
        raise ArgumentError, "No values for enum select tag" unless values
        tag_text = ''
        template = options.dup
        template.delete('checked')
        values.each do |enum|
          opts = template.dup
          opts['checked'] = 'checked' if v and v == enum
          opts['id'] = "#{opts['id']}_#{enum}"
          tag_text << "<label>#{enum}: "
          tag_text << to_radio_button_tag(enum, opts)
          tag_text << "</label>"
        end
        tag_text
      end
def to_enum_radio_tag ( options = { } ) begin v = value ( object ) rescue ArgumentError v = value end add_default_name_and_id ( options ) values = enum_values raise ArgumentError , "No values for enum select tag" unless values tag_text = '' template = options . dup template . delete ( 'checked' ) values . each do | enum | opts = template . dup opts [ 'checked' ] = 'checked' if v and v == enum opts [ 'id' ] = "#{opts['id']}_#{enum}" tag_text << "<label>#{enum}: " tag_text << to_radio_button_tag ( enum , opts ) tag_text << "</label>" end tag_text end
Creates a set of radio buttons and labels.
Creates a set of radio buttons and labels .
# Remove when we no longer support 1.1.
options