Class: Lafcadio::MonthField

Inherits:
DateField show all
Defined in:
lib/lafcadio/objectField/MonthField.rb

Overview

Accepts a Month as a value. This field automatically saves in MySQL as a date corresponding to the first day of the month.

Constant Summary

Constants inherited from DateField

DateField::RANGE_NEAR_FUTURE, DateField::RANGE_PAST

Instance Attribute Summary

Attributes inherited from DateField

#range

Attributes inherited from ObjectField

#dbFieldName, #default, #defaultFieldName, #hideDisplay, #hideLabel, #name, #notNull, #notUniqueMsg, #objectType, #unique, #writeOnce

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from DateField

#initialize, #valueFromSQL

Methods inherited from ObjectField

#<=>, #bind_write?, #dbWillAutomaticallyWrite, #db_table_and_field_name, #englishName, #firstTime, #initialize, instantiateFromXml, instantiateWithParameters, instantiationParameters, #nameForSQL, #nullErrorMsg, #prevValue, #processBeforeVerify, #valueFromSQL, #verify, #verifyUniqueness

Constructor Details

This class inherits a constructor from Lafcadio::DateField

Class Method Details

.valueTypeObject

:nodoc:



8
9
10
# File 'lib/lafcadio/objectField/MonthField.rb', line 8

def MonthField.valueType #:nodoc:
	Month
end

Instance Method Details

#valueForSQL(value) ⇒ Object

:nodoc:



12
13
14
# File 'lib/lafcadio/objectField/MonthField.rb', line 12

def valueForSQL(value) #:nodoc:
	"'#{value.year}-#{value.month}-01'"
end