Imagine I've got a Publish Model.

and something record within the database is going to be:

23|title_here|content_here|2011-02-20 08:01:55.583222|2011-02-20 08:01:55.583222

and also the latter area (2011-02-20 08:01:55.583222|2011-02-20 08:01:55.583222 ) would be the produced_at and up-to-date_at area.

Then,

post = Post.find_by_id(23)

Question: How do i obtain the produced_at string: "2011-02-20 08:01:55.583222" within the database?

As you may know, the publish.produced_when needed return a ActiveSupport::TimeWithZone object, not the raw string.

Help :)

use attributes_before_type_cast

Post.find(23).attributes_before_type_cast["created_at"]

or

Post.find(23).read_attribute_before_type_cast("created_at")

Edit

You are able to call such as this also:

Post.find(23).created_at_before_type_cast

based on Accessing attributes before they have been typecasted link.

Try

Post.find_by_id(23).created_at.to_s