Displaying 2 results from an estimated 2 matches for "before_type_case".
Did you mean:
before_type_cast
2008 Jul 02
0
before_type_case broken?
Hey,
I''ve noticed that I seem unable to get a _before_type_cast value for
dates in 2.1. Specifically, if I assign a date string to a date
attribute, and then call attribute_before_type_cast I get a TimeWithZone
instead of a String:
model.start_date = "2001/01/02"
model.start_date.class = ActiveSupport::TimeWithZone
model.start_date_before_type_cast.class =
2006 Jan 15
6
PROPOSAL: Validations as Mixin
...n examples are Contact Us forms, multi-step forms, web service
paramater validations, etc.
I took a look at the source for Validations, and it seems that it is
very independent from ActiveRecord. I caught only three depenedencies:
1. validates_numericy --> depends on ActiveRecords'' before_type_case
2. The exceptions were from the ActiveRecord namespace
3. Including Validations hooked on methods like save
It would seem to me that Validations would be best off as an independent
mixin. All ActiveRecord would need to do is mix it, add
validates_numericay (1), catch the exceptions and rethrow...