diff --git a/README.rdoc b/README.rdoc index 36f363c..d49265a 100644 --- a/README.rdoc +++ b/README.rdoc @@ -1,13 +1,13 @@ -= validates_timeliness += ValidatesTimeliness * Source: http://github.com/adzap/validates_timeliness * Bugs: http://github.com/adzap/validates_timeliness/issues -== DESCRIPTION: +== Description: Validate dates, times and datetimes for Rails 3.x and ActiveModel. -== FEATURES: +== Features: * Adds ActiveModel validation for dates, times and datetimes @@ -19,7 +19,7 @@ Validate dates, times and datetimes for Rails 3.x and ActiveModel. * Adds before_type_cast method on validated attributes -== INSTALLATION: +== Installation: As plugin (from master) @@ -50,7 +50,7 @@ This adds the validation helper methods to ActiveRecord. Replace it with the ORM As long as it supports ActiveModel it should work. -== USAGE: +== Usage: To validate a model with a date, time or datetime attribute you just use the validation method @@ -91,9 +91,9 @@ Regular validation options: :unless - Execute validation when :unless evaluates false -== CONFIGURATION +== Configuration -=== ERROR MESSAGES +=== Error Messages Using the I18n system to define new defaults: @@ -112,7 +112,7 @@ Using the I18n system to define new defaults: The %{restriction} signifies where the interpolation value for the restriction will be inserted. -=== RESTRICTION OPTION SHORTHAND +=== Restriction Option Shorthand It is common to restrict an attribute to being on or before the current time or current day. To specify this you need to use a lambda as an option value e.g. lambda { Time.now }. @@ -123,7 +123,7 @@ Just provide the symbol as the option value like so: validates_date :birth_date, :on_or_before => :today -The :today symbol is evaluated as lambda { Date.today }.call. The :now and :today +The :today symbol is evaluated as lambda { Date.today }. The :now and :today symbols are pre-configured. Configure your own like so: # in the setup block @@ -132,7 +132,7 @@ symbols are pre-configured. Configure your own like so: ) -=== DUMMY DATE FOR TIME TYPES +=== Dummy Date For Time Types Given that Ruby has no support for a time-only type, all time type columns are evaluated as a regular Time class objects with a dummy date value set. Rails defines the dummy date as @@ -145,7 +145,7 @@ need to customize this for some reason you can do so as follows The value should be an array of 3 values being year, month and day in that order. -=== TEMPORAL RESTRICTION ERRORS: +=== Temporal Restriction Errors: When using the validation temporal restrictions there are times when the restriction option value itself may be invalid. This will add an error to the model such as @@ -159,7 +159,7 @@ To turn them on/off: config.ignore_restriction_errors = true -=== DISPLAY INVALID VALUES IN DATE/TIME SELECT HELPERS: +=== Display invalid values in date/time select helpers: The plugin offers an extension for ActionView to allowing invalid date and time values to be redisplayed to the user as feedback, instead of @@ -173,9 +173,9 @@ To activate it, put this in an initializer: config.enable_date_time_select_extension! -=== STRICT DATE/TIME VALUES FOR SELECT HELPERS +=== Strict date/time values for select helpers -When using date/time select helpers, the component values are handled by ActiveRecord using +when using date/time select helpers, the component values are handled by ActiveRecord using the Time class to instantiate them into a time value. But this mean that some invalid dates, such as 31st June, are shifted forward and treated as valid. To handle these cases in a strict way you can enable the plugin handler to treat them as invalid dates. @@ -189,6 +189,6 @@ To activate it, put this in an initializer: ... -== LICENSE: +== License: Copyright (c) 2008-2010 Adam Meehan, released under the MIT license