Sha256: f8c68b4a420eb1aa96b3f514f2b81249a9a7f96152718dc76278ba4c5003c81a

Contents?: true

Size: 619 Bytes

Versions: 8

Compression:

Stored size: 619 Bytes

Contents

Formtastic::SemanticFormBuilder.class_eval do

  def enum_input(method, options = {})
    options[: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

8 entries across 8 versions & 1 rubygems

Version Path
has_enum-0.10.0 lib/has_enum/formtastic.rb
has_enum-0.9.4 lib/has_enum/formtastic.rb
has_enum-0.9.3 lib/has_enum/formtastic.rb
has_enum-0.9.2.1 lib/has_enum/formtastic.rb
has_enum-0.9.2 lib/has_enum/formtastic.rb
has_enum-0.9.1 lib/has_enum/formtastic.rb
has_enum-0.9.0 lib/has_enum/formtastic.rb
has_enum-0.8.2 lib/has_enum/formtastic.rb