Module: Sequel::Plugins::Forme::InstanceMethods
- Defined in:
- lib/sequel/plugins/forme.rb
Instance Method Summary collapse
-
#forme_config(form) ⇒ Object
Configure the
formwith support forSequel::Modelspecific 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::Inputinstance 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.
488 489 490 |
# File 'lib/sequel/plugins/forme.rb', line 488 def forme_config(form) form.namespaces << forme_namespace end |
#forme_default_request_method ⇒ Object
507 508 509 |
# File 'lib/sequel/plugins/forme.rb', line 507 def forme_default_request_method 'post' end |
#forme_form_class(base) ⇒ Object
Return subclass of base form that includes the necessary Sequel form methods.
493 494 495 496 497 498 499 500 |
# File 'lib/sequel/plugins/forme.rb', line 493 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.
503 504 505 |
# File 'lib/sequel/plugins/forme.rb', line 503 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.
517 518 519 |
# File 'lib/sequel/plugins/forme.rb', line 517 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.
512 513 514 |
# File 'lib/sequel/plugins/forme.rb', line 512 def forme_use_required_abbr? true end |