updated some comments

This commit is contained in:
Adam Meehan 2008-12-03 21:20:53 +11:00
parent 71f2a43424
commit 6f4306973b

View File

@ -1,20 +1,19 @@
module ValidatesTimeliness module ValidatesTimeliness
module ActiveRecord module ActiveRecord
# The crux of the plugin is being able to store raw user entered values # Rails 2.1 removed the ability to retrieve the raw value of a time or datetime
# while not interfering with the Rails 2.1 automatic timezone handling. This # attribute. The raw value is necessary to properly validate a string time or
# requires us to distinguish a user entered value from a value read from the # datetime value instead of the internal Rails type casting which is very limited
# database. Both maybe in string form, but only the database value should be # and does not allow custom formats. These methods restore that ability while
# interpreted as being in the default timezone which is normally UTC. The user # respecting the automatic timezone handling.
# entered value should be interpreted as being in the current zone as indicated
# by Time.zone.
# #
# To do this we must cache the user entered values on write and store the raw # The automatic timezone handling sets the assigned attribute value to the current
# value in the attributes hash for later retrieval and possibly validation. # zone in Time.zone. To preserve this localised value and capture the raw value
# Any value from the database will not be in the attribute cache on first # we cache the localised value on write and store the raw value in the attributes
# read so will be considered in default timezone and converted to local time. # hash for later retrieval and possibly validation. Any value from the database
# It is then stored back in the attributes hash and cached to avoid the need # will not be in the attribute cache on first read so will be considered in default
# for any subsequent differentiation. # timezone and converted to local time. It is then stored back in the attributes
# hash and cached to avoid the need for any subsequent differentiation.
# #
# The wholesale replacement of the Rails time type casting is not done to # The wholesale replacement of the Rails time type casting is not done to
# preserve the quickest conversion for timestamp columns and also any value # preserve the quickest conversion for timestamp columns and also any value