Class: OpenWFE::Extras::Field
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- OpenWFE::Extras::Field
- Defined in:
- lib/openwfe/extras/participants/activeparticipants.rb
Overview
A Field (Attribute) of a Workitem.
Class Method Summary collapse
-
.new_field(key, value) ⇒ Object
A quick method for doing.
-
.search(text, storename_list = nil) ⇒ Object
Will return all the fields that contain the given text.
Instance Method Summary collapse
Class Method Details
.new_field(key, value) ⇒ Object
486 487 488 489 490 491 492 493 |
# File 'lib/openwfe/extras/participants/activeparticipants.rb', line 486 def self.new_field (key, value) f = Field.new f.fkey = key f.vclass = value.class.to_s f.value = value f end |
.search(text, storename_list = nil) ⇒ Object
Will return all the fields that contain the given text.
Looks in svalue and fkey. Looks as well in yvalue if it contains a string.
This method is used by Workitem.search()
529 530 531 532 533 534 535 536 537 538 539 540 |
# File 'lib/openwfe/extras/participants/activeparticipants.rb', line 529 def self.search (text, storename_list=nil) cs = build_search_conditions(text) if storename_list cs[0] = "(#{cs[0]}) AND workitems.store_name IN (?)" cs << storename_list end find :all, :conditions => cs, :include => :workitem end |
Instance Method Details
#value ⇒ Object
513 514 515 516 517 518 519 |
# File 'lib/openwfe/extras/participants/activeparticipants.rb', line 513 def value return YAML.load(self.svalue) \ if SPECIAL_FIELD_CLASSES.include?(self.vclass) self.svalue || self.yvalue end |
#value=(v) ⇒ Object
495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 |
# File 'lib/openwfe/extras/participants/activeparticipants.rb', line 495 def value= (v) limit = connection.native_database_types[:string][:limit] if v.is_a?(String) and v.length <= limit self.svalue = v elsif SPECIAL_FIELD_CLASSES.include?(v.class.to_s) self.svalue = v.to_yaml else self.yvalue = v end end |