On Sep 17, 5:10 am, Maciek <[email protected]> wrote:
> Hi, I'm new to sequel and it took me a while to figure out how to set
> timestamps on a model.
> Is this the right way? Are there any better alternative ways?
>
> class Category < Sequel::Model(:categories)
> plugin :timestamps, :update_on_create => true
> end
>
> Thanks
That is the "web 2.0" way. It is not the "right" way. The right way
is to let the DBMS do its job and timestamp things itself when the
rows are inserted. That requires implementing a trigger and related
function. An example is given in the PostgreSQL docs at
http://www.postgresql.org/docs/8.4/static/plpgsql-trigger.html.
The reason being is that ALL audit data from an application is
tainted. Only the DBMS itself can verify the time something happened
and what connection id was used.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sequel-talk" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---