A metal ruler is a conductor, so the charge of whatever kind it acquires on rubbing against hair flows through the ruler to our body. The ruler gets discharged and does not attract the paper bits. However, a plastic ruler, being an insulator, acquires static electricity on rubbing against hair and attracts the paper bits when brought closer to them.