Is there an easy way to determine what is the “type” of a member in the
Params hash? The reason that I ask this question is that I have to make
adjustments for UK dates in the params hash for date and datetime
fields.
The date and datetime fields are being returned as Strings. So when I
assign the hash to an instance variable’s attributes as follows:
@entry.attributes = params[:entry]
for example. The program errors out. I have to Normalize the String
representation of UK dates in in US dates (still String format) before
the
lvar = params[:entry]
unless lvar[:example_date].nil?
lvar[:date] = ParseDate.normalize_date(lvar[:example_date])
end
@entry.attributes = lvar
statement is executed and then everything works fine. But this is a lot
of ugly duplicate coding accounting for specific members of params hash
that are date and datetime type. I was hoping that there might be an
elegant solution to this problem.
Thanks in advance for your time.
Bharat