You may be interested in the _before_type_cast accessor - that will
let you read whatever the DB is actually returning.

I'm somewhat curious what makes sense for a dateless, zoneless time.
Either the app that consumes the data is *assuming* the missing info
(hard to do, as even time comparisons get nasty across DST boundaries)
or the data is (maybe?) some kind of elapsed time.

--Matt Jones

On Jul 13, 3:21 pm, Josh <joshbwh...@gmail.com> wrote:
> Thanks for all the points and it is useful to think about the rails
> time not having time_of_day. I still am not sure my problem was clear.
> It seems to me that there should at least be a :emulate_datetime =>
> false sort of option like with booleans, ex.
>
> ActiveRecord::ConnectionAdapters::MysqlAdapter.emulate_booleans =
> false
>
> The table simply holds 21:25:42, but activerecord retrieves the
> information in the AR Hash as
>
> time => "2000-01-01 21:25:42"
>
> Where then does date, 2000-01-01 come from? It looks to me like rails
> is just guessing,  Shouldn't thee be a way for it to retreive time as
> a string, time=> "2001-01-01" ?
>
> I think the last suggestion from Alpha Blue will have to be my current
> solution, don't use the mysql time object and instead use a string.
>
> On Jul 12, 6:48 am, "Älphä Blüë" <rails-mailing-l...@andreas-s.net>
> wrote:
>
>
>
> > You said that you have atimeobject but that it holds a "string".  If
> > you are updating your mysql db with a string format oftimeand you
> > specify the column as a string you can return it as a string and format
> > it anyway you want using gsub.
>
> > In either case, you can convert anything returned from mysql using gsub.
>
> > The first question you should ask yourself is what type of column do I
> > have in my mysql db?
>
> > --
> > Posted viahttp://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to