Re: DateTime and date/time fields

2008-06-04 Thread Farrel
On Jun 4, 1:21 am, Jeremy Evans [EMAIL PROTECTED] wrote: 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

Re: DateTime and date/time fields

2008-06-04 Thread Jeremy Evans
On Jun 4, 12:40 am, Farrel [EMAIL PROTECTED] wrote: On Jun 4, 1:21 am, Jeremy Evans [EMAIL PROTECTED] wrote: 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

Re: DateTime and date/time fields

2008-06-04 Thread Farrel
On Jun 4, 4:46 pm, Jeremy Evans [EMAIL PROTECTED] wrote: What may not have been clear is that when you load data from the database, the model does not typecast it, so if the database adapter gives you a Time, it doesn't get converted to a DateTime. Ah I see so this is why the problem occured.

Re: DateTime and date/time fields

2008-06-04 Thread Jeremy Evans
On Jun 4, 7:57 am, Farrel [EMAIL PROTECTED] wrote: On Jun 4, 4:46 pm, Jeremy Evans [EMAIL PROTECTED] wrote: What may not have been clear is that when you load data from the database, the model does not typecast it, so if the database adapter gives you a Time, it doesn't get converted to a

Re: DateTime and date/time fields

2008-06-03 Thread Farrel
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

Re: DateTime and date/time fields

2008-06-03 Thread Farrel
I should also add this is on a Postgres databases, Sequel 2.0 stable gem, Ruby 1.8.6 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sequel-talk group. To post to this group, send email to

Re: DateTime and date/time fields

2008-06-03 Thread Farrel
Here's the code for the Organisation class class Organisation Sequel::Model before_validation do if self.new? self.uuid = UUID.random_create.to_s end end before_create do creation_time = Time.now self.created_at = creation_time self.updated_at = creation_time

Re: DateTime and date/time fields

2008-06-02 Thread Jeremy Evans
On Jun 2, 7:56 am, Farrel [EMAIL PROTECTED] wrote: I noticed with Sequel 2.0 that the Ruby object for a Postgres timestamp field is now a DateTime instead of a Time object. Is DateTime the default for all date and time related fields or is Time and Date objects used in other cases? The