mirror of
https://github.com/ditkrg/validates_timeliness.git
synced 2026-01-22 22:06:45 +00:00
extend AR by default if present
This commit is contained in:
parent
53f3d876ea
commit
10f49144c3
@ -38,16 +38,17 @@ Then run
|
|||||||
|
|
||||||
rails generate validates_timeliness:install
|
rails generate validates_timeliness:install
|
||||||
|
|
||||||
This creates configuration initializer and locale files. In the initializer, you need to uncomment the extend_classes setting like so
|
This creates configuration initializer and locale files. In the initializer, you there are a number of config options to customize the plugin.
|
||||||
|
|
||||||
ValidatesTimeliness.setup do |config|
|
ValidatesTimeliness.setup do |config|
|
||||||
|
|
||||||
config.extend_classes = [ ActiveRecord::Base ]
|
# Add validation helpers to these classes
|
||||||
|
# config.extend_classes = [ ActiveRecord::Base ]
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
This adds the validation helper methods to ActiveRecord. Replace it with the ORM of your choosing.
|
By default the plugin extends ActiveRecord if present. If you are using one or more other ORMs, you need to add them to this config option array.
|
||||||
As long as it supports ActiveModel it should work.
|
As long as the ORM supports ActiveModel it should work.
|
||||||
|
|
||||||
|
|
||||||
== Usage:
|
== Usage:
|
||||||
|
|||||||
@ -17,7 +17,7 @@ module ValidatesTimeliness
|
|||||||
|
|
||||||
# Add validation helpers to these classes
|
# Add validation helpers to these classes
|
||||||
mattr_accessor :extend_classes
|
mattr_accessor :extend_classes
|
||||||
@@extend_classes = []
|
@@extend_classes = [ defined?(ActiveRecord) && ActiveRecord::Base ].compact
|
||||||
|
|
||||||
# Set the dummy date part for a time type values.
|
# Set the dummy date part for a time type values.
|
||||||
mattr_accessor :dummy_date_for_time_type
|
mattr_accessor :dummy_date_for_time_type
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user