Sha256: 132f9b3965ef92351703ad32288087b9f09ed17b3065934a9a08f1b3c53142ad

Contents?: true

Size: 532 Bytes

Versions: 3

Compression:

Stored size: 532 Bytes

Contents

Formtastic::SemanticFormBuilder.class_eval do

  def enum_input(method, options = {})
    options.merge! :collection => object.class.values_for_select_tag(method),
                   :wrapper_html => {:class => :enum}
    select_input method, options
  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

3 entries across 3 versions & 1 rubygems

Version Path
has_enum-0.8.0 lib/has_enum/formtastic.rb
has_enum-0.7.3 lib/has_enum/formtastic.rb
has_enum-0.7.2.1 lib/has_enum/formtastic.rb