Module: Sequel::Plugins::Forme::InstanceMethods
- Defined in:
- lib/sequel/plugins/forme.rb
Instance Method Summary collapse
-
#forme_config(form) ⇒ Object
Configure the
form
with support forSequel::Model
specific code, such as support for nested attributes. - #forme_default_request_method ⇒ Object
-
#forme_form_class(base) ⇒ Object
Return subclass of base form that includes the necessary Sequel form methods.
-
#forme_input(form, field, opts) ⇒ Object
Return
Forme::Input
instance based on the given arguments. -
#forme_namespace ⇒ Object
Use the underscored model name as the default namespace.
-
#forme_use_required_abbr? ⇒ Boolean
Whether to set an abbr tag in labels for required inputs.
Instance Method Details
#forme_config(form) ⇒ Object
Configure the form
with support for Sequel::Model
specific code, such as support for nested attributes.
472 473 474 |
# File 'lib/sequel/plugins/forme.rb', line 472 def forme_config(form) form.namespaces << forme_namespace end |
#forme_default_request_method ⇒ Object
491 492 493 |
# File 'lib/sequel/plugins/forme.rb', line 491 def forme_default_request_method 'post' end |
#forme_form_class(base) ⇒ Object
Return subclass of base form that includes the necessary Sequel form methods.
477 478 479 480 481 482 483 484 |
# File 'lib/sequel/plugins/forme.rb', line 477 def forme_form_class(base) unless klass = MUTEX.synchronize{FORM_CLASSES[base]} klass = Class.new(base) klass.send(:include, SequelForm) MUTEX.synchronize{FORM_CLASSES[base] = klass} end klass end |
#forme_input(form, field, opts) ⇒ Object
Return Forme::Input
instance based on the given arguments.
487 488 489 |
# File 'lib/sequel/plugins/forme.rb', line 487 def forme_input(form, field, opts) SequelInput.new(self, form, field, opts).input end |
#forme_namespace ⇒ Object
Use the underscored model name as the default namespace.
501 502 503 |
# File 'lib/sequel/plugins/forme.rb', line 501 def forme_namespace model.send(:underscore, model.name) end |
#forme_use_required_abbr? ⇒ Boolean
Whether to set an abbr tag in labels for required inputs.
496 497 498 |
# File 'lib/sequel/plugins/forme.rb', line 496 def forme_use_required_abbr? true end |