On Jun 3, 1:15 pm, Farrel <[EMAIL PROTECTED]> wrote:
> On Jun 2, 6:59 pm, Jeremy Evans <[EMAIL PROTECTED]> wrote:
>
> > The value you get from the database is adapter specific (I think Time
> > is used in most cases).  When using models with typecasting, it will
> > always cast to a DateTime and not a Time.  I'll accept patches for
> > adapters to use a DateTime field instead of a Time field.
>
> I've found some inconsistent code with Sequel's handling of Time and
> DateTime. I have an Organisation class that sets the created_at and
> updated_at fields when the object is created and subsequently updated.
> When an object is created the class of updated_at is Time. On a
> subsequent save it becomes DateTime and after the model is reloaded it
> switches back to Time. Below is a capture of an IRb session which
> shows this.

Yes, and that's the current expected behavior.  As I mentioned, I'll
accept patches to fix it so that DateTime is returned by the adapter.
You should change the before_* hooks to use a DateTime if you want to
use that, though it really won't matter much for your case.
Alternatively, you can override things to always provide Time instead
of DateTime.  The only reason that DateTime is the default is that it
has a larger range than Time, so it works when Time does not (dates
before 1900, for example).

Jeremy
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To post to this group, send email to sequel-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sequel-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to