I think you want a DateTime property instead?

On 09/29/2013 03:25 AM, [email protected] wrote:
> Hi,
>
> I am new to DataMapper, trying it out with sqlite3.
>
> I declared a property as
>
>  property :created_at, Time, :default => lambda {|r,p| Time.now }
>
> What confuses me is that the created_at property ends up
> in the db as '2013-09-29T12:14:09.074859+02:00', but when
> I access it from ruby, I get a truncated Time object:
> 2013-09-29 00:00:00 +0200
>
> Can someone explain? Is this a bug?
>
> See below for a list of installed gems.
>
> Best,
> Kilian
>
> dm-aggregates (1.2.0)
> dm-constraints (1.2.0)
> dm-core (1.2.1)
> dm-do-adapter (1.2.0)
> dm-migrations (1.2.0)
> dm-serializer (1.2.2)
> dm-sqlite-adapter (1.2.0)
> dm-timestamps (1.2.0)
> dm-transactions (1.2.0)
> dm-types (1.2.2)
> dm-validations (1.2.0)
> dm-sqlite-adapter (1.2.0)
> do_sqlite3 (0.10.13)
> sqlite3 (1.3.8)
>
> On Saturday, April 16, 2011 4:06:50 PM UTC+2, DAZ wrote:
>
>     Hi,
>
>     The docs say the following date types are available:
>
>       DateTime, Date, Time
>
>     I have always just used DateTime, but would actually like to work in
>     seconds and therefore use a Time object.
>
>     Is there any difference in the background in using Time as a type?
>
>     e.g.:
>
>       property :created_at,   Time, :default =>  proc { |m,p| Time.now}
>
>     cheers,
>
>     DAZ
>
> -- 
> You received this message because you are subscribed to the Google
> Groups "DataMapper" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/datamapper.
> For more options, visit https://groups.google.com/groups/opt_out.


-- 
Blog: http://postmodern.github.com/
GitHub: https://github.com/postmodern
Twitter: @postmodern_mod3
PGP: 0xB9515E77

-- 
You received this message because you are subscribed to the Google Groups 
"DataMapper" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/datamapper.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to