Sha256: bf126b5825dda0f584b27911cdabfd904918e972446422cdbe1906c967a05a68

Contents?: true

Size: 618 Bytes

Versions: 1

Compression:

Stored size: 618 Bytes

Contents

begin
  require 'formtastic'

  Formtastic::SemanticFormBuilder.class_eval do

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

Version data entries

1 entries across 1 versions & 1 rubygems

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