module Sequel::Plugins::Forme::InstanceMethods

  1. lib/sequel/plugins/forme.rb

Methods

Public Instance

  1. forme_config
  2. forme_form_class
  3. forme_input

Constants

FORM_CLASSES = {::Forme::Form=>Form}  
MUTEX = Mutex.new  

Public Instance methods

forme_config (form)

Configure the form with support for Sequel::Model specific code, such as support for nested attributes.

[show source]
# File lib/sequel/plugins/forme.rb, line 463
def forme_config(form)
  form.namespaces << model.send(:underscore, model.name)
end
forme_form_class (base)

Return subclass of base form that includes the necessary Sequel form methods.

[show source]
# File lib/sequel/plugins/forme.rb, line 468
def forme_form_class(base)
  unless klass = MUTEX.synchronize{FORM_CLASSES[base]}
    klass = Class.new(base)
    klass.send(:include, SequelForm)
    klass.send(:include, ERBSequelForm) if defined?(::Forme::ERB::Form) && base == ::Forme::ERB::Form
    MUTEX.synchronize{FORM_CLASSES[base] = klass}
  end
  klass
end
forme_input (form, field, opts)

Return Forme::Input instance based on the given arguments.

[show source]
# File lib/sequel/plugins/forme.rb, line 479
def forme_input(form, field, opts)
  SequelInput.new(self, form, field, opts).input
end