Class: Lafcadio::AutoIncrementField
- Inherits:
-
IntegerField
- Object
- ObjectField
- IntegerField
- Lafcadio::AutoIncrementField
- Defined in:
- lib/lafcadio/objectField/AutoIncrementField.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#objectType ⇒ Object
readonly
Returns the value of attribute objectType.
Attributes inherited from ObjectField
#dbFieldName, #default, #defaultFieldName, #hideDisplay, #hideLabel, #name, #notNull, #notUniqueMsg, #unique, #writeOnce
Instance Method Summary collapse
- #HTMLWidgetValueStr(value) ⇒ Object
-
#initialize(objectType, name, englishName = nil) ⇒ AutoIncrementField
constructor
A new instance of AutoIncrementField.
Methods inherited from IntegerField
Methods inherited from ObjectField
#<=>, #bind_write?, #dbWillAutomaticallyWrite, #db_table_and_field_name, #englishName, #firstTime, instantiateFromXml, instantiateWithParameters, instantiationParameters, #nameForSQL, #nullErrorMsg, #prevValue, #processBeforeVerify, #valueForSQL, #valueFromSQL, valueType, #verify, #verifyUniqueness
Constructor Details
#initialize(objectType, name, englishName = nil) ⇒ AutoIncrementField
Returns a new instance of AutoIncrementField.
7 8 9 10 |
# File 'lib/lafcadio/objectField/AutoIncrementField.rb', line 7 def initialize(objectType, name, englishName = nil) super(objectType, name, englishName) @objectType = objectType end |
Instance Attribute Details
#objectType ⇒ Object (readonly)
Returns the value of attribute objectType.
5 6 7 |
# File 'lib/lafcadio/objectField/AutoIncrementField.rb', line 5 def objectType @objectType end |
Instance Method Details
#HTMLWidgetValueStr(value) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/lafcadio/objectField/AutoIncrementField.rb', line 12 def HTMLWidgetValueStr(value) if value != nil super value else highestValue = 0 ObjectStore.getObjectStore.getAll(objectType).each { |obj| aValue = obj.send(name).to_i highestValue = aValue if aValue > highestValue } (highestValue + 1).to_s end end |