mirror of
https://github.com/ditkrg/validates_timeliness.git
synced 2026-01-22 22:06:45 +00:00
readme
This commit is contained in:
parent
423d60f885
commit
bceb0d508f
26
README.rdoc
26
README.rdoc
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
Validate dates, times and datetimes for Rails 3.x and ActiveModel.
|
Validate dates, times and datetimes for Rails 3.x and ActiveModel.
|
||||||
|
|
||||||
If you a looking for the old version for Rails 2.x go here:http://github.com/adzap/validates_timeliness/tree/v2.3.
|
If you a looking for the old version for Rails 2.x go here:[http://github.com/adzap/validates_timeliness/tree/v2.3].
|
||||||
|
|
||||||
|
|
||||||
== Features
|
== Features
|
||||||
@ -51,8 +51,7 @@ This creates configuration initializer and locale files. In the initializer, you
|
|||||||
end
|
end
|
||||||
|
|
||||||
By default the plugin extends ActiveRecord if present. Currently ActiveRecord is the only ORM included for extension. If you wish to extend
|
By default the plugin extends ActiveRecord if present. Currently ActiveRecord is the only ORM included for extension. If you wish to extend
|
||||||
another ORM then look at the shim for ActiveRecord to see how to setup the hooks.
|
another ORM then look at the {shim for ActiveRecord}:[http://github.com/adzap/validates_timeliness/tree/master/lib/validates_timeliness/orms/active_record.rb] to see how to setup the hooks.
|
||||||
http://github.com/adzap/validates_timeliness/tree/master/lib/validates_timeliness/orms/active_record.rb
|
|
||||||
|
|
||||||
To extend other ORMs is pretty straight forward. It's matter of hooking into a couple of methods, being the attribute method generation and
|
To extend other ORMs is pretty straight forward. It's matter of hooking into a couple of methods, being the attribute method generation and
|
||||||
timezone handling of validated attributes. However, the plugin must support the ActiveModel validations system. If you extend an ORM
|
timezone handling of validated attributes. However, the plugin must support the ActiveModel validations system. If you extend an ORM
|
||||||
@ -181,6 +180,18 @@ symbols are pre-configured. Configure your own like so:
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
=== Default Timezone
|
||||||
|
|
||||||
|
The plugin needs to know the default timezone you are using when parsing or type casting values. If you are using
|
||||||
|
ActiveRecord then the default is automatically set to the same default zone as ActiveRecord. If you are using
|
||||||
|
another ORM you may need to change this setting.
|
||||||
|
|
||||||
|
# in the setup block
|
||||||
|
config.default_timezone = :utc
|
||||||
|
|
||||||
|
By default it will be UTC if ActiveRecord is not loaded.
|
||||||
|
|
||||||
|
|
||||||
=== 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
|
Given that Ruby has no support for a time-only type, all time type columns are evaluated
|
||||||
@ -222,9 +233,9 @@ To activate it, put this in an initializer:
|
|||||||
config.enable_date_time_select_extension!
|
config.enable_date_time_select_extension!
|
||||||
|
|
||||||
|
|
||||||
=== Stricter Parsing for Select Helpers
|
=== Strict Parsing 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,
|
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
|
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.
|
way you can enable the plugin handler to treat them as invalid dates.
|
||||||
@ -235,6 +246,11 @@ To activate it, put this in an initializer:
|
|||||||
config.enable_multiparameter_extension!
|
config.enable_multiparameter_extension!
|
||||||
|
|
||||||
|
|
||||||
|
== Credits
|
||||||
|
|
||||||
|
* Adam Meehan (adam.meehan@gmail.com, http://github.com/adzap)
|
||||||
|
|
||||||
|
|
||||||
== License
|
== License
|
||||||
|
|
||||||
Copyright (c) 2008-2010 Adam Meehan, released under the MIT license
|
Copyright (c) 2008-2010 Adam Meehan, released under the MIT license
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user