method
read_date_parameter_value
v3.1.0 -
Show latest stable
- Class:
ActiveRecord::Base
read_date_parameter_value(name, values_hash_from_param)private
No documentation available.
# File activerecord/lib/active_record/base.rb, line 2053
def read_date_parameter_value(name, values_hash_from_param)
set_values = (1..3).collect{|position| values_hash_from_param[position].blank? ? 1 : values_hash_from_param[position]}
begin
Date.new(*set_values)
rescue ArgumentError => ex # if Date.new raises an exception on an invalid date
instantiate_time_object(name, set_values).to_date # we instantiate Time object and convert it back to a date thus using Time's logic in handling invalid dates
end
end