mirror of
https://github.com/ditkrg/validates_timeliness.git
synced 2026-01-23 06:16:44 +00:00
can use super for some InstanceTag methods
cleans up for DateTimeSelect extension a little
This commit is contained in:
parent
20c0aaa793
commit
bfcab52c22
@ -10,7 +10,6 @@ module ValidatesTimeliness
|
|||||||
|
|
||||||
included do
|
included do
|
||||||
alias_method_chain :datetime_selector, :timeliness
|
alias_method_chain :datetime_selector, :timeliness
|
||||||
alias_method_chain :value, :timeliness
|
|
||||||
end
|
end
|
||||||
|
|
||||||
module InstanceMethods
|
module InstanceMethods
|
||||||
@ -22,13 +21,13 @@ module ValidatesTimeliness
|
|||||||
datetime_selector_without_timeliness(*args)
|
datetime_selector_without_timeliness(*args)
|
||||||
end
|
end
|
||||||
|
|
||||||
def value_with_timeliness(object)
|
def value(object)
|
||||||
unless @timeliness_date_or_time_tag && @template_object.params[@object_name]
|
unless @timeliness_date_or_time_tag && @template_object.params[@object_name]
|
||||||
return value_without_timeliness(object)
|
return super
|
||||||
end
|
end
|
||||||
|
|
||||||
pairs = @template_object.params[@object_name].select {|k,v| k =~ /^#{@method_name}\(/ }
|
pairs = @template_object.params[@object_name].select {|k,v| k =~ /^#{@method_name}\(/ }
|
||||||
return value_without_timeliness(object) if pairs.empty?
|
return super if pairs.empty?
|
||||||
|
|
||||||
values = [nil] * 6
|
values = [nil] * 6
|
||||||
pairs.map do |(param, value)|
|
pairs.map do |(param, value)|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user