[typo] comments with created_at field wrong?

Maurizio Lemmo - Tannoiser tannoiser at tenzione.it
Sun Jan 22 14:37:53 EST 2006


* domenica 22 gennaio 2006, alle 17:01, Maurizio Lemmo - Tannoiser scrive:
> I search a bit, and I found this: http://dev.rubyonrails.org/ticket/2257

On this subject, again, i tested this sql code:

CREATE OR REPLACE FUNCTION my_fix_time() RETURNS trigger AS '
BEGIN
new.created_at = current_timestamp;
return new;
END;
' language plpgsql;

CREATE TRIGGER my_fix_time_comment before insert on comments for each
row execute procedure my_fix_time();

CREATE TRIGGER my_fix_time_articles before insert on articles for each
row execute procedure my_fix_time();

That seems solve the created_at issue.
I share it because different from what suggested on dev.rubyonrails (I
guess it depends from postgres version)

It's a temporary solution, but better than update manually the entry in
the db... :)

HTH.

-- 
                          Maurizio - Tannoiser - Lemmo
                 Founder Member of ERLUG http://erlug.linux.it
-------------------------------------------------------------------------------
Veronica: God Lilly, I see the Prozac's working.
Lilly: High on life, Veronica Mars. I've got a secret. A good one.
	-- Veronica Mars: 1x01


More information about the Typo-list mailing list