I have a table product(id,name) and table product_raiting(product_id,rate_type,rate). When I create new product, I need to create three raitings for this product.
How can I add postgres trigger with do something like:
product.create
product.product_raitings.create( :rate_type => 0, :rate => 0 )
product.product_raitings.create( :rate_type => 1, :rate => 0 )
product.product_raitings.create( :rate_type => 2, :rate => 0 )
product.product_raitings.create( :rate_type => 3, :rate => 0 )
Please help.