Sha256: fc6f7ec66f8052658209b4fa25d3fc22e21e38ae74805df8650653a6e1dc6400

Contents?: true

Size: 438 Bytes

Versions: 6

Compression:

Stored size: 438 Bytes

Contents

module FreeForm
  module FormInputKey
    def self.included(base)
      base.extend(ClassMethods)
    end
        
    module ClassMethods
      def form_input_key(name)
        constant = name.to_s.camelize
        Object.const_set(constant, Class.new) unless Object.const_defined?(constant)    
        define_singleton_method(:model_name) do
          ActiveModel::Name.new(constant.constantize)
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
freeform-0.0.4 lib/freeform/form/form_input_key.rb
freeform-0.0.3.rc4 lib/freeform/form/form_input_key.rb
freeform-0.0.3.rc3 lib/freeform/form/form_input_key.rb
freeform-0.0.3.rc2 lib/freeform/form/form_input_key.rb
freeform-0.0.3.rc1 lib/freeform/form/form_input_key.rb
freeform-0.0.2 lib/freeform/form/form_input_key.rb