Sha256: e6f7a9959aac28fcac82cf7874002dc9aab161fffca8a13cf6027960446359b3
Contents?: true
Size: 671 Bytes
Versions: 3
Compression:
Stored size: 671 Bytes
Contents
module ActiveEnum module FormHelpers module Formtastic def self.included(base) base.alias_method_chain :default_input_type, :active_enum end def default_input_type_with_active_enum(method, options) return :enum if @object.class.enum_for(method) default_input_type_without_active_enum end def enum_input(method, options) raise "Attribute '#{method}' has no enum class" unless enum = @object.class.enum_for(method) select_input(method, options.merge(:collection => enum.to_select)) end end end end Formtastic::SemanticFormBuilder.send :include, ActiveEnum::FormHelpers::Formtastic
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
active_enum-0.8.1 | lib/active_enum/form_helpers/formtastic.rb |
active_enum-0.8.0 | lib/active_enum/form_helpers/formtastic.rb |
active_enum-0.7.1 | lib/active_enum/form_helpers/formtastic.rb |