vendor/plugins/enum-column/lib/enum/active_record_helper.rb
def to_enum_select_tag(options = {})
        # Remove when we no longer support 1.1.
        begin
          v = value(object)
        rescue ArgumentError
          v = value
        end
        add_default_name_and_id(options)
        tag_text = "<select"
        tag_text << tag_options(options)
        tag_text << ">"
        values = enum_values
        raise ArgumentError, "No values for enum select tag" unless values
        if options[:include_blank]
          tag_text << "<option value=\"\"></option>\n"
        end
        values.each do |enum|
          tag_text << "<option value=\"#{enum}\""
          tag_text << ' selected="selected"' if v and v == enum
          tag_text << ">#{enum}</option>"
        end
        tag_text << "</select>"
      end
# Create a select tag and one option for each of the
# enumeration values.
Create a select tag and one option for each of the
enumeration values.
Create a select tag and one option for each of the enumeration values .
def to_enum_select_tag(options = {})
        begin
          v = value(object)
        rescue ArgumentError
          v = value
        end
        add_default_name_and_id(options)
        tag_text = "<select"
        tag_text << tag_options(options)
        tag_text << ">"
        values = enum_values
        raise ArgumentError, "No values for enum select tag" unless values
        if options[:include_blank]
          tag_text << "<option value=\"\"></option>\n"
        end
        values.each do |enum|
          tag_text << "<option value=\"#{enum}\""
          tag_text << ' selected="selected"' if v and v == enum
          tag_text << ">#{enum}</option>"
        end
        tag_text << "</select>"
      end
def to_enum_select_tag ( options = { } ) begin v = value ( object ) rescue ArgumentError v = value end add_default_name_and_id ( options ) tag_text = "<select" tag_text << tag_options ( options ) tag_text << ">" values = enum_values raise ArgumentError , "No values for enum select tag" unless values if options [ :include_blank ] tag_text << "<option value=\"\"></option>\n" end values . each do | enum | tag_text << "<option value=\"#{enum}\"" tag_text << ' selected="selected"' if v and v == enum tag_text << ">#{enum}</option>" end tag_text << "</select>" end
Create a select tag and one option for each of the
enumeration values.
Create a select tag and one option for each of the enumeration values .
# Remove when we no longer support 1.1.
options