Good Link
A note: you should put the rules above the trigger keyword to be syntactically correct.
rules
trigger