Class: Lafcadio::MonthField

Inherits:
DateField show all
Defined in:
lib/lafcadio/objectField.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.

Instance Attribute Summary

Attributes inherited from ObjectField

#db_field_name, #domain_class, #mock_value, #name, #not_nil

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from DateField

#initialize, mock_value, #value_from_sql

Methods inherited from ObjectField

#<=>, #bind_write?, create_from_xml, create_with_args, creation_parameters, #db_column, #db_will_automatically_write?, #default_mock_value, #initialize, #prev_value, #process_before_verify, #value_from_sql, #verify, #verify_non_nil_value

Constructor Details

This class inherits a constructor from Lafcadio::DateField

Class Method Details

.value_typeObject

:nodoc:



502
503
504
# File 'lib/lafcadio/objectField.rb', line 502

def self.value_type #:nodoc:
	Month
end

Instance Method Details

#value_for_sql(value) ⇒ Object

:nodoc:



506
507
508
# File 'lib/lafcadio/objectField.rb', line 506

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