Sha256: 5c8a72cacec79a146f7095a55519f9fcd6224aff81407370c6c865f8bed2f3b7

Contents?: true

Size: 624 Bytes

Versions: 1

Compression:

Stored size: 624 Bytes

Contents

Formtastic::SemanticFormBuilder.class_eval do

  def enum_input(method, options = {})
    options.merge! :collection => object.class.values_for_select_tag(method)
    if object.class.has_multiple_enum? method
      check_boxes_input method, options
    else
      select_input method, options.merge(:wrapper_html => {:class => :enum})
    end
  end

  def default_input_type_with_enum(method, options={})
    if object.class.respond_to?(:enums) && object.class.has_enum?(method)
      :enum
    else
      default_input_type_without_enum(method, options)
    end
  end

  alias_method_chain :default_input_type, :enum

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
has_enum-0.8.1.1 lib/has_enum/formtastic.rb