Module | DateColumn
In: | lib/date_column.rb

日付を格納するカラムのアクセサを置き換えるモジュール。

### Methods

date_column

### Public Instance methods

date_column(*column_names)

[Source]

        # File lib/date_column.rb, line 5
     5:   def date_column(*column_names)
     6:     column_names.each do |column_name|
     7:       column_name = column_name.to_s
     8:       class_eval "def \#{column_name}\nvalue = read_attribute(\#{column_name.dump})\nreturn value ? value.to_display_date : value\nend\ndef \#{column_name}_before_type_cast\nvalue = read_attribute(\#{column_name.dump})\nreturn value ? value.to_display_date : value\nend\ndef \#{column_name}=(value)\nvalue = value.to_db_date if value\nwrite_attribute(\#{column_name.dump}, value)\nend\n", __FILE__, __LINE__+1
     9:     end
    10:   end

[Validate]